0

How to use databinder in EventLisener ?

asked 2009-01-12 02:27:32 +0800

evpole gravatar image evpole
481 2

updated 2009-01-12 02:39:01 +0800

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 ?

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-01-12 02:31:12 +0800

evpole gravatar image evpole
481 2

If i use include or iframe instead of the macro-component,it seems can't pass an object to the popup window.
so I choosed the macro-component.

link publish delete flag offensive edit

answered 2009-01-12 06:01:28 +0800

RyanWu gravatar image RyanWu
533 2
about.me/flyworld

maybe you can add binder in the main page and
try to use inline macro ?

link publish delete flag offensive edit

answered 2009-01-12 08:43:16 +0800

evpole gravatar image evpole
481 2

Thanks for advise,I've tryed but failed.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-01-12 02:27:32 +0800

Seen: 200 times

Last updated: Jan 12 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More