-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I want to use an action to perform zAu.send sever the MVVM pattern
Thank
file .zul
<window id="fmisTabFlowketoan" apply="org.zkoss.bind.BindComposer"
closable="false" height="@load(vm.heightPx)"
viewModel="@id('vm') @init('com.evnit.fmis.viewmodel.quytrinhlamviec.QuytrinhKetoanVM')"
border="none">
<script type="text/javascript">
<![CDATA[
function valid(){
zAu.send(new zk.Event(zk.Widget.$(this), 'onValidate'));
}
]]>
</script>
<h:button onclick="valid();">Send simple string</h:button>
</window>
File Code java Mvvm
public class QuytrinhKetoanVM extends BaseViewModel {
@Init
public void initVM() {
}
@AfterCompose
public void afterCompose(@ContextParam(ContextType.VIEW) Component view) {
Selectors.wireComponents(view, this, false);
}
@Command("onFlowform")
public void onFlowform(Event event) {
System.out.println("Call form highcharts");
}
@Command("onValidate")
public void onValidate() {
System.out.println("Call form highcharts");
}
@Override
public void onClose(Event event) {
}
}
First of all, your not working MVVM.
You work a mix of MVVM/MVC because you initialize the MVC in your aftercompose.
Maybe for this purpose you can do it so you can use the @Listen annotation like the fiddle but if this is not needed => don't do it.
Here is a fiddle where you can check your code with.
Otherwise if you use ZK 8 please read this topic.
Greetz Chill.
Asked: 2016-03-24 07:23:25 +0800
Seen: 31 times
Last updated: Mar 24 '16
How to stop combining commands in an ajax call ?
zk developmet is esay [closed]
Need help with scrolling horizontal tabs in Right-to-Left (Arabic)
Create tab dynamically, multitab application
Radio button value change on database value
How to implement, each user has its own session timeout time