-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I'm trying to use a grid with rows having a <detail> item.
I have a fulfill attibute on it:
fulfill="onOpen=/xyz/mypage.zul"
I need to pass to "mypage.zul" an attribute (a master code to filter items on the underlying page).
How can I pass it?
I don't like to get it by "a parent sequence" from "mypage.zul" itself.
Can anyone help me?
Any hint will be appreciate.
Thanks
I solved myself in this way.
The grid is bound with a data bean.
I get the bean for the current row and pass it to detail page.
This is a fragment for the page where grid is:
<row> <detail open="false" fulfill="onOpen"> <zscript> Row current_row = self.parent; int index = current_row.getParent().getChildren().indexOf(current_row); Object row_data = current_row.getGrid().getModel().get(index); </zscript> <include src="/xyz/mypage.zul" rowSelected="${row_data}"/> </detail> ..... other row items here ...... </row>
In mypage.zul I get the data bean in this way:
<zk> <zscript> Object data = Executions.getCurrent().getAttribute("rowSelected"); </zscript> </zk>
In this way the page "mypage.zul" is encapsulated, because don't need to reference any component from the calling one.
Bye
There's a another approach to use onFulfill event to get the model your need from Detail.
<row> <detail fulfill="onOpen" > <attribute name="onFulfill" ><![CDATA[ /* Row current_row = self.parent; int index = current_row.getParent().getChildren().indexOf(current_row); Object row_data = current_row.getGrid().getModel().get(index); */ HashMap map = new HashMap(); map.put("rowSelected","Mydata"); Executions.createComponents("test2.zul",self,map); ]]></attribute> </detail> </row>
test2.zul
<div>asdasd ${arg.rowSelected}</div>
And if you want to get the arguments in included page's zscript ,
another way is to use arg ( implict object ).
like
<div>asdasd ${arg.rowSelected} <zscript> System.out.println(arg.get("rowSelected")); </zscript> </div>
Asked: 2011-05-10 07:43:31 +0800
Seen: 382 times
Last updated: May 12 '11