-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi I have a problem and I do not find the mistake...
First of all don't blame me for my english, and my not that professional coding skills.
However I created a menu using menubar etc. the onClick event is always: onClick="sel_item(self.label)"
The function:
<zscript> sel_item(self) { menu_sel = self; } </zscript>
I even tested with an alert message and the correct value I am expecting is shown. But here is the core problem:
After setting the variable menu_sel - I included a switch, that should normally load the correct pages...
<zk switch="${menu_sel}"> <zk case="Menuentry"> <include src="/Main/Menu1/Menuentry.zul"/> </zk> <zk> <include src="/Main/home.zul"/> </zk> </zk>
Thanks in advance for your help & advice.
Best regards,
Eric
When you call the sel_item, the page has been already rendered and the switch already evaluated, so, even if you change the
menu_sel value, nothing happens.
Try something like this:
<zk> <include id="content" src="/Main/home.zul /> <zscript> void sel_item(String item) { if (item.equals("Menuentry")) content.setSrc("/Main/Menu1/Menuentry.zul"); else content.setSrc("/Main/home.zul"); } </zscript> </zk>
Asked: 2008-12-04 10:50:46 +0800
Seen: 148 times
Last updated: Dec 05 '08