Friday, September 14, 2012

1-How to pass parameter with command in ZK?
Answer:-
<listbox id="chosenLb" vflex="true" width="250px"
                model="@load(vm.chosenDataModel)">
                <listhead>
                    <listheader label="Selected Column List"></listheader>

                </listhead>

                <template name="model" var="each">

                    <listitem>

                        <listcell label="@bind(each.value)">
                            <separator orient="vertical" width="100px" />

                            <checkbox checked="${each.checked}" onCheck="@command('onCheckedEvent',item=each.value,check=self.checked)" />
                        </listcell>
                    </listitem>
                </template>
            </listbox>
And in ViewModel class you have to right like this...
 @Command("onCheckedEvent")
    public void onCheckedEvent(@BindingParam("item") String item,@BindingParam("check") boolean checked) {
        System.out.println("clicked of " + item  + "is checked=" + checked);
}

If you using this feature u need to add NotifyChange also in above method .
Thats it...Thanks to ZK...ZK HELP