-
FEATURED COMPONENTS
First time here? Check out the FAQ!
In my application I have a modal window not "closable".
In this window I have two buttons, one to close and one that performs business logic by @command('save').
<zk> <window id="window" width="700px" title="@load(vm.title)" border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('it.eng.fbm.viewmodel.MyVM')"> ... ... ... <button label="${c:l('resultedit.button.save')}" onClick="@command('save')" ></button> <button label="${c:l('resultedit.button.undo')}" onClick="window.onClose()" ></button> ... ... ... </window> </zk>
The implementation of this command needs the Window reference to close the window:
@Command public void save(@SelectorParam("#window") Window window) { try { // do buiseness logic window.onClose(); } catch (ApplicationException e) { log.error(e.getMessage()); e.printStackTrace(); } }
This breaks decoupling between the view and the model.
Is there a way to avoid it?
I posted a request here http://tracker.zkoss.org/browse/ZK-986
Asked: 2012-03-26 14:32:05 +0800
Seen: 776 times
Last updated: Mar 28 '12