Added onAfterTabChange callback, fixed tab switching this way

Both temperature graph and terminal need to be updated AFTER the tab has been switched (onAfterTabChange) not before (onTabChange).
This commit is contained in:
Gina Häußge committed 2015-02-23 14:55:43 +01:00
1 parent 8b4b5fb058
commit b9fd3dda7d
3 files changed
+14 -3

No files matched your search

+11
View File
@@ -248,6 +248,17 @@ $(function() {
});
});
$('#tabs a[data-toggle="tab"]').on('shown', function (e) {
var current = e.target.hash;
var previous = e.relatedTarget.hash;
_.each(allViewModels, function(viewModel) {
if (viewModel.hasOwnProperty("onAfterTabChange")) {
viewModel.onAfterTabChange(current, previous);
}
});
});
// Fix input element click problems on dropdowns
$(".dropdown input, .dropdown label").click(function(e) {
e.stopPropagation();
@@ -354,11 +354,11 @@ $(function() {
}
};
self.onTabChange = function(current, previous) {
self.onAfterTabChange = function(current, previous) {
if (current != "#temp") {
return;
}
temperatureViewModel.updatePlot();
self.updatePlot();
}
}
@@ -152,7 +152,7 @@ $(function() {
return true;
};
self.onTabChange = function(current, previous) {
self.onAfterTabChange = function(current, previous) {
if (current != "#terminal") {
return;
}