Page already covered by data binder exception when dynamically opening ZUL pages

raevel2
72 1 2

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?

delete retag edit

5 Replies

SimonD
3

Hi,

After been bitten by this myself I think the nicest solution I've seen was posted by jjrafael at http://www.zkoss.org/forum/listComment/13994

yaryan997
210 2

@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..

m17
39

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
72 1 2

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}">


937 2 12

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,

[hide preview]