-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi I am really new to ZK...I need to create Tabs dynamically...for example if an admin logs in, certain tabs hav to b displayed which cannot b displayed to ordinary users....
I think it is easier to have all the tabs you need and hide the ones according the user logged in...
<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="Tab Sample" border="normal">
<tabbox>
<tabs>
<tab label="" />
<tab label="" if="1==2" />
</tabs>
<tabpanels>
<tabpanel></tabpanel>
<tabpanel if="1==2" >
</tabpanel>
</tabpanels>
</tabbox>
</window>
</zk>
So the tab are not Created if the user is not administrator and no zk components inside that tab is created.
hi bala..cud u explain this a lil bit...
before creating the component zk will verify the if and unless conditions if exist. i.e., if you have "if" or "unless" condition in the code, then before creating the component it gets evaluated. it is similar to
<zk: if = "1==2">
<tabpanel />
</zk>
So only if the condition is successful, the below code gets executed.
I disagree with the recommendation given. I think that you would be best off to use <zscript> to create the tabs dynamically at first and then you may decide that you prefer to use Java to extend the tab object to include the functionality that you desire. However, this will require you to become more familiar with the zul class hierarchy and API. It may sound like a lot of work, but it's hugely beneficial to know it if you are going to be working with ZK on a regular basis.
Dave
Asked: 2010-02-11 03:31:24 +0800
Seen: 721 times
Last updated: Feb 17 '10