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 2015-02-23 14:55:43 +01:00
parent 8b4b5fb058
commit b9fd3dda7d
3 changed files with 14 additions and 3 deletions

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();

View file

@ -354,11 +354,11 @@ $(function() {
}
};
self.onTabChange = function(current, previous) {
self.onAfterTabChange = function(current, previous) {
if (current != "#temp") {
return;
}
temperatureViewModel.updatePlot();
self.updatePlot();
}
}

View file

@ -152,7 +152,7 @@ $(function() {
return true;
};
self.onTabChange = function(current, previous) {
self.onAfterTabChange = function(current, previous) {
if (current != "#terminal") {
return;
}