-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
Is there a way to add a common message at the beginning of all tab panels inside a tabbox? In my code below, I am adding a Welcome message in each tab panel. I am doing the same action three times
Is there a way to add a header message inside the "Tabpanels" component which can then be applied to all tabpanels rather than adding the same message in each "Tabpanel" component. I would like to add such messages dynamically in multiple tab panels, so it would be nice if I could add a common message at one place.
<tabbox id="tb" height="300px"> <tabs id="tabs"> <tab id="A" label="Tab A" ></tab> <tab id="B" label="Tab B" ></tab> <tab id="C" label="Tab C" ></tab> </tabs> <tabpanels> <tabpanel>Welcome</tabpanel> <tabpanel>Welcome</tabpanel> <tabpanel>Welcome</tabpanel> </tabpanels> </tabbox>
Thanks,
Sony
vsony7,
If the message is static, why not use EL to do it? Here is a modification to your example:
<zk> <zscript> public String tabWelcomeMsg = new String("Hello and Welcome"); </zscript> <window> <tabbox id="tb" height="300px"> <tabs id="tabs"> <tab id="A" label="Tab A"></tab> <tab id="B" label="Tab B"></tab> <tab id="C" label="Tab C"></tab> </tabs> <tabpanels> <tabpanel><label value="${tabWelcomeMsg}"/></tabpanel> <tabpanel><label value="${tabWelcomeMsg}"/></tabpanel> <tabpanel><label value="${tabWelcomeMsg}"/></tabpanel> </tabpanels> </tabbox> </window> </zk>
If not static, you could always use databinding.
Hope that helps,
Todd
The idea is to add an error message in all tab panels. Say, I add a new tabpanel in my tabbox in future, I will have to add "<label value="${tabWelcomeMsg}"/>" in the new tabpanel as well. Ofcourse, it is not a show stopper and I can do that but I was wondering if there was a simpler way to add a component like a hbox common to all tabpanels? See my pseudo code below:
<tabpanels> <hbox> Some error/warning/information message goes here </hbox> <tabpanel> Panel 1 </tabpanel> <tabpanel> Panel 2 </tabpanel> .... </tabpanels>
Asked: 2012-03-07 19:18:55 +0800
Seen: 778 times
Last updated: Oct 04 '12