To work around that ALTUI difference, I have my timeout callback make sure my container element is on the page, using a very specific jQuery selector to match both an ID and class I want (that is unlikely to be used elsewhere), something like this: [tt]if ( jQuery( ‘div#conditions.reactortab’ ).length == 0 ) return; // I’m no longer displayed, stop working.[/tt][/quote]
Since I have no idea what I’m doing, I’m back.
Html += ‘
to the beginning of my html and added
’).length == 0 )
Utils.logError(“***** length == 0 *****”);
onBeforeCpanelClose(); // stop the interval for StatusList
return; // I’m no longer displayed, stop working.
to the beginning of DisplayStatusList and now if I click the back arrow or devices or scenes, everything works great!!
Unfortunately, if I Actions/Used In/Notifications in the lower menu or the Options tab (which is flash) it still keeps seeing the length as non-zero.
I assume this is because I completely misunderstood your suggestion.
Remember, you’re talking to a real noob here when it comes to html. :)[/quote]
It’s usually benign to update in hidden content. Not perfectly efficient, admittedly, but it can have the advantage that when the user returns to the tab, it’s already displaying valid data.
If you really need to take it further and shut down that interval firing when your tab is not displayed (even if another tab for the same device is), you’re going to need to figure out how the UI’s container is handling tabs. The implementation of tabs in pretty much every system I’ve worked with involves the hiding of the container for the content of the tab. When you switch between tabs, the content doesn’t go away, the container is simply hidden and the container of the tab just clicked is made visible. If you browse the DOM, you find the entire content of every tab is there (in some cases, it may only be every tab that has been displayed so far, and in some cases, it’s all of them). In this case, you’re going to need to dig for the tab implementation’s container element (I don’t know off-hand what it is by id and/or class, I’ve never needed to go that far) and look at its visibility in your test. But it will be different in UI7 vs ALTUI, so that complicates matters. And I’m sure the upcoming UI8 will be different as well. You may be better off just letting it update in the background silently. Eventually, the cpanel close event or the length test will catch up with it.