-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I'm creating a tree with 2 menu, add user and user list. Clicking the menu(toolbar button actually) will change the source page of iframe. It works fine if I click the menu for the first time, but nothing happened if I click the same menu afterwards. To make it working again, I have to click other menu first.
In my case, on sucessful add user, it will redirect to another page. So the user will have to click the tree menu again to add another user, which is not working unless he/she click on other menu first.
It seems treecell implements onChange instead onClick ? Can I change this behavior ? Or perhaps there are better approach for my case. Thank you very much.
Please download the source code of ZKSandbox and dig into its implementation, you will find what you want.
hi all I m new in ZK & i m student i want create file explorar to do this i create the sample for practic..
<window apply="ecbackend.HomeComposer" height="100%">
<borderlayout>
<north size="15%">
<hbox>
<image src="images/grails_logo.png"/>
</hbox>
</north>
<center autoscroll="true">
<iframe id="mainFrame" src="merchantList.zul" height="100%" width="100%"/>
</center>
<west splittable="true" size="15%">
<tree>
<treechildren>
<treeitem label="Merchant Management">
<treechildren>
<treeitem>
<treerow>
<treecell>
<toolbarbutton id="tbrAddMerchant" label="Add Merchant"/>
</treecell>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell>
<toolbarbutton id="tbrMerchantList" label="Merchant List"/>
</treecell>
</treerow>
</treeitem>
</treechildren>
</treeitem>
</treechildren>
</tree>
</west>
</borderlayout>
</window>
now the question is . "If i click on second tree node i.e tbrAddMerchant the page sholud be display on the iframe to do this what i have to do
pls help.... Thanks In Advanc..
@Panpur,
In ZK5, the JavaScript does the same optimized code, so that you have to override the setSrc method at client side.
For example,
<iframe xmlns:w="http://www.zkoss.org/2005/zk/client" id="mainFrame" src="merchantList.zul" height="100%" width="100%"> <attribute w:name="setSrc"> function (value) { this._src = value; var n = this.$n(); if (n) n.src = value || ''; } </attribute> </iframe>
For further details, please take a look at the smalltalk.
Nothing is happened when you change src of frame or include to same value. This is because of zk inner optimization. If you want to reload frame content you should set null value and then real source.
iframe.setSrc(null); iframe.setSrc(<you url>);
Hello Chen, this is my home.zul code:
<window apply="ecbackend.HomeComposer" height="100%"> <borderlayout> <north size="15%"> <hbox> <image src="images/grails_logo.png"/> </hbox> </north> <center autoscroll="true"> <iframe id="mainFrame" src="merchantList.zul" height="100%" width="100%"/> </center> <west splittable="true" size="15%"> <tree> <treechildren> <treeitem label="Merchant Management"> <treechildren> <treeitem> <treerow> <treecell> <toolbarbutton id="tbrAddMerchant" label="Add Merchant"/> </treecell> </treerow> </treeitem> <treeitem> <treerow> <treecell> <toolbarbutton id="tbrMerchantList" label="Merchant List"/> </treecell> </treerow> </treeitem> </treechildren> </treeitem> </treechildren> </tree> </west> </borderlayout> </window>
And this is composer code for changing the frame's source:
class HomeComposer extends GrailsComposer { def mainFrame, tbrAddMerchant, tbrMerchantList def afterCompose = { window -> // initialize components here } def onClick_tbrAddMerchant() { mainFrame.src = "createMerchant.zul" } def onClick_tbrMerchantList() { mainFrame.src = "merchantList.zul" } }
Could you please post a runnable example?
Asked: 2010-04-16 04:59:24 +0800
Seen: 884 times
Last updated: May 01 '11