-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'm testing the "fulfill" attribute of the tabpanel tag and have a question. Please run the sample code below, then click Tab B and then Tab C. Notice the code behavior is that it "fulfills" the tab contents when clicking on the Tabs only once. Is there an "un-fulfill" option so that, say, when I click Tab B, the code will "un-fulfill" Tab A and Tab C, and only loads Tab B contents. Then when I click Tab A, the code will un-fulfill Tab B and Tab C contents, and only load Tab A content, etc... That way, the sample code below would have the correct behavior: when clicking on any Tab, it'll un-load all other Tab contents and only load the selected Tab content. In the sample test case, it should display the most current date/time when clicking any Tab. Any insight is greatly appreciated. Thanks..
<tabbox id="tb" height="300px"> <tabs id="tabs"> <tab id="A" label="Tab A" selected='true'/> <tab id="B" label="Tab B" /> <tab id="C" label="Tab C" /> </tabs> <tabpanels> <tabpanel> <label id="labelA" /> <timer id="timerA" delay="3000" onTimer="labelA.setValue(new Date().toString())" /> </tabpanel> <tabpanel fulfill='B.onSelect'> <label id="labelB" /> <timer id="timerB" delay="3000" onTimer="labelB.setValue(new Date().toString())" /> </tabpanel> <tabpanel fulfill='C.onSelect'> <label id="labelC" /> <timer id="timerC" delay="3000" onTimer="labelC.setValue(new Date().toString())" /> </tabpanel> </tabpanels> </tabbox>
you can 'unload' = detach the components with xxx.getChildren().clear();
My first quick shoot to modify the sample code fails. I'm not the zscript guy. I mean you can solve your issue in a clean java code controller by catching the onSelect events.
<tabbox id="tb" height="300px"> <tabs id="tabs"> <tab id="A" label="Tab A" selected='true' /> <tab id="B" label="Tab B" onSelect='tabPanelC.getChildren().clear()' /> <tab id="C" label="Tab C" onSelect='tabPanelB.getChildren().clear()' /> </tabs> <tabpanels> <tabpanel> <label id="labelA" /> <timer id="timerA" delay="3000" onTimer="labelA.setValue(new Date().toString())" /> </tabpanel> <tabpanel id="tabPanelB" fulfill='B.onSelect'> <label id="labelB" /> <timer id="timerB" delay="3000" onTimer="labelB.setValue(new Date().toString())" /> </tabpanel> <tabpanel id="tabPanelC" fulfill='C.onSelect'> <label id="labelC" /> <timer id="timerC" delay="3000" onTimer="labelC.setValue(new Date().toString())" /> </tabpanel> </tabpanels> </tabbox>
Asked: 2012-04-22 23:22:55 +0800
Seen: 164 times
Last updated: Apr 23 '12