asked
2009-01-12 02:27:32 +0800
evpole 481 ● 2 I need to create a popup window in an EventLisener,and pass an Object to it.in the window,a macro Component is used,and I need to use databinder in it.
codes like this (main page's controller):
button.addEventListener("onClick", new EventListener(){
public void onEvent(Event arg0) throws Exception {
final Window bcw=new Window();
bcw.setVariable("bill", bill,false);
HtmlMacroComponent gl = (HtmlMacroComponent)page.getComponentDefinition("goodslistbox", false).newInstance(page,null);
gl.setParent(bcw);
gl.afterCompose();
});
the macro goodslistbox is(macro-page) :
<box>
<listbox model="@{bill.goodslist}" id="listbox">
<listhead>
<listheader label="Goods Name" />
</listhead>
<listitem self="@{each='g'}" id="listitem">
<listcell label="@{g.name}" id="gname"/>
</listitem>
</listbox>
</box>
Now , my problem is that if i declare the binder(<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>) in the main page ,the binder sames dosen't work. if i declare the binder in the macro-page, it works at the first time when user click the button,and at the second time,it shows an error says:"the page is already covered by another databinder,can't be coverd by this one."
Could anyone please help me ?