-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a main ZUL page with a window, in this window I want to open other ZUL pages dynamically.
I do this by fetching the main page's Window and running
Executions.createComponents(zulPageUri, mainWin, null);
The problem I'm having is that the ZUL pages I include have data binder's associated with them (using <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?> in their ZUL pages). If I open more than one new page I get the error "org.zkoss.zk.ui.UiException: Page is already covered by another Data Binder. Cannot be covered by this Data Binder again. Page:mainPage", where mainPage is the id of the main page that includes the other ZUL's. The main page does not have the AnnotateDataBinderInit.
I tried moving the data binding init to the main page (like I do when i use <include>), but then data bindings were not enabled on the inner pages.
How should I go about fixing this problem, and letting all my inner pages use data bindings?
You have to inform the binder the target (root) component for that binder in each zul page. If you omit this, it'll append the binder in the page, thus the error you're getting. Will be something like (not tested pseudo code read javadoc):
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" root="wnd"?> <window id="wnd" >components here...</window>
Regards,
Madruga
Thanks! I managed to get this working properly now.
For the record I ended up adding a counter to my controller, and for every new window i open i set args.put("windowId", counter++); and then in my ZUL pages:
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" root="./${arg.windowId}" ?> <window id="${arg.windowId}">
just a question - why do you need to include this sequential number in the window name ?.
Since ZK 3.5.0 the databinder is stored in the specified component scope. So you could simple specify current window and it works fine.
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" root="./win" ?> <window id="win">
@raevel2
Hi.. friend
I did as you said to solve my error "org.zkoss.zk.ui.UiException: Page is already covered by another Data Binder. Cannot be covered by this Data Binder again. Page:mainPage" but it throws me another error "org.zkoss.zk.ui.UiException: ID cannot be empty"
just help me to get out of this..
thanx in advance
Asked: 2010-05-04 02:53:13 +0800
Seen: 2,597 times
Last updated: Mar 02 '11