membuat checkbox mvvm zk zkoss

Membuat checkbox sederhana pada framework zk (zkoss) menggunakan teknik mvvm

q> Buat file zul -> cobaCheckbox.zul


<zk>
 <window apply="org.zkoss.bind.BindComposer"
 viewModel="@id('vm')@init('com.ipi.zk7.mywebzk7.CobaCheckboxVM')"
 validationMessages="@id('vmsgs')">

 <checkbox onCheck="@command('pilih', checked = self.checked) " />


 </window>
</zk>

q> Buat file zul -> cobaCheckboxVM.java


package com.ipi.zk7.mywebzk7;

import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zul.Messagebox;

public class CobaCheckboxVM {

 @NotifyChange({"cek"})
 @Command
 public void pilih(@BindingParam("checked") boolean isPicked){
 Messagebox.show("Pilih = " + isPicked);
 }

}

q> Hasil

Selection_011

Selection_012

Published by

saifiahmada

Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s