-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a modal window that displays a listbox. What's the best way of returning a listbox selection result from a modal window?
I'm creating the modal window using 'createComponents'.
Davout,
You might try doing something like this:
main.zul
<zk> <window id="win" onReceive="getModalData();"> <button label="Open" onClick='Executions.createComponents("modalWindow.zul", win,null);'/> <label id="lbl"/> <zscript> void getModalData(){ lbl.setValue(event.getData()); } </zscript> </window> </zk>
modalWindow.zul
<zk> <window title="please input" border="normal" mode="modal"> <attribute name="onClose"> Events.postEvent(new Event("onReceive",self.getParent(), tb.getValue())); </attribute> <textbox id="tb" /> <button label="Accept" onClick='Events.postEvent(new Event("onClose",self.getParent()));'/> </window> </zk>
Hopefully this will give you an idea or two.
Regards,
Todd
There are samples of such modal search listboxes in my blog. All of them gives back a selected object.
The little trick is the private constructor and a static method for calling them.
call: Branch branch = BranchSearchListBox.show(parentComponent);
Such a pure java solution can be modified in 10 minutes to work for an other search approach.
best
Stephan
PS: See such a searchListBox working live in the customer dialog module here .
In the dialog you must first click the CRUD 'edit' button than you can try three of these searchListBoxes. 'simple', 'advanced' and 'extended'
Hi Stephan
In your case, i think you created the search customer in pure java. But in my case, i have a seperate zul and controller using MVC.
And also, i am calling using execute.create components.
So in this case, how we can receive the return value ?
Can you please help me
Thank you vicent. But i am using MVVM . Can you please help me on that too..?
Asked: 2011-05-23 15:55:10 +0800
Seen: 1,045 times
Last updated: Jun 15 '12