membuat komponen combobox zk

Membuat komponen combobox menggunakan zk framework

Bismillah

q> buat file cobaCombobox.zul


<zk>
 <window apply="org.zkoss.bind.BindComposer"
 viewModel="@id('vm')@init('com.ipi.zk7.mywebzk7.CobaComboboxVM')"
 validationMessages="@id('vmsgs')">
 <label value="Pilih Pekerjaan :"/>
 <separator/>
 <combobox selectedItem="@bind(vm.job)">
 <comboitem label="Karyawan" value="karyawan" />
 <comboitem label="Pegawai" value="pegawai" />
 <comboitem label="Buruh" value="buruh" />
 <comboitem label="Lain-lain" value="lain" />
 </combobox>

 <button onClick="@command('simpan')" label="Tes" />

 </window>
</zk>

q> buat file CobaComboboxVM.java


package com.ipi.zk7.mywebzk7;

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

public class CobaComboboxVM {

 private String job;

 public String getJob() {
 return job;
 }

public void setJob(String job) {
 this.job = job;
 }

@Command
 public void simpan(){
 Messagebox.show("Job = " + job);
 }

}

q> Hasil :

Selection_015

Selection_016

Alhamdulillah

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