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:
parent
8b4b5fb058
commit
b9fd3dda7d
3 changed files with 14 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue