| Page 1 of 1 | [ 4 posts ] |
Hammad
|
Hello,
I have an application with two tabs in it, the two tabs are essentially the same in means of the html elements. I have JS functionality in the tabs which updates those html elements. Now the problem is, if you make both tabs active by selecting them, both will have same elements and same JS and those will not work for live data. What I am looking for, is there a way, you could simple reset the dataSrc so when a tab gets inactive, it destroy all of its elements and when you make it active again, it fetches the src again. Thanks, |
|
Hello Hammad,
You can listen for "beforeActiveTabChange" at the tabview level: beforeActiveTabChange ( event ) Fires before the value for the configuration attribute 'activeTab' changes. Return false to cancel the attribute change. Parameters: event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value. http://developer.yahoo.com/yui/docs/YAH ... eTabChange This way, you can set the content of the oldValue tab to empty right before the content of the new tab gets set. Also, make sure that you set dataCache to false at the tab level. Best Regards, Caridy |
Hammad
|
Thanks Caridy, You was once again of great help. I was using beforeActiveChange but was not setting cacheData to false.
Here is the piece of code if anyone else stumbles across this problem again: Code: tabView.on("beforeActiveTabChange", function(o) { if(tabView.get("activeTab").get("label") === "Tab1"){ document.getElementById("myDataTable1").innerHTML = ""; }else if(tabView.get("activeTab").get("label") === "Tab2"){ document.getElementById("myDataTable2").innerHTML = ""; } }); where myDataTable1 and myDataTable2 are the divs in which I enclose all of the HTML in the tabs. |
|
Hey Hammad,
I'm glad to help. One more thing that come to my mind is: don't forget the clean up (purge) the content of the element (myDataTable1) or destroy the YUI DataTable before removing the content. This will help with the memory leaks in IE. Best Regards, Caridy |
| Page 1 of 1 | [ 4 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group