Suggested case list:
Using timer to refresh a grid
383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlinkuser model to move item to another listbox
120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlinkDisabled list item row passed to VM-1981
296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlinkDisabled list item row passed to VM-1981
295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlinkDisabled list item row passed to VM-1981
294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlinkgrid sample with ListModel/RowRenderer
816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlinkgrid sample with ListModel/RowRenderer
809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlinkgrid sample with ListModel/RowRenderer
196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlinkgrid sample with ListModel/RowRenderer
195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlinkgrid sample with ListModel/RowRenderer
194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlinkgrid sample with ListModel/RowRenderer
193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlinkgrid sample with ListModel/RowRenderer
192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlinkgrid sample with ListModel/RowRenderer
191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlinkHierarchy table without using ZK PE/EE
1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlinkgrid sample with ListModel/RowRenderer
128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlinkuser model to move item to another listbox
1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlinkUsing timer to refresh a grid
1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlinkFire a event from child iframe
1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlinkTextbox input restriction sample
1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlinkTest web core taglib in ZUL
1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlinkLatest 10 Fiddles :
font awesome effects
1guest172.71.166.21232nla3hApr 18, 2024 6:04:43 PMlinkfont awesome effects
245guest172.71.166.21220t2jmoApr 18, 2024 6:04:41 PMlinkZK-5696
1JamesChu162.158.187.3739iuvhmApr 18, 2024 10:33:52 AMlinkListbox colspan header version 2
3guest172.71.183.199jkpp6qApr 17, 2024 1:54:19 PMlinkZK-5695
1guest162.158.90.1402is2rctApr 17, 2024 10:23:20 AMlinkLocalDate in datebox
2guest172.70.243.516v49n7Apr 17, 2024 6:05:17 AMlinkLocalDate in datebox
1guest172.70.243.516v49n7Apr 17, 2024 6:04:18 AMlinkLocalDate in datebox
1guest172.70.243.511m6i0gcApr 17, 2024 6:04:04 AMlinkAnother new ZK fiddle
1guest141.101.69.1271plv0hpApr 17, 2024 5:37:43 AMlinkpdf set content media
2guest172.68.18.22635q7pbApr 16, 2024 9:27:52 PMlinkDual Listbox From ZK
7Deny180.250.162.36286hu6sAug 23, 2016 8:40:41 AMlinkresources
index.zulzul<!-- Define Component Class -->
<?component name="dual-listbox" extends="div" class="pkg$.demo.listbox.dual_listbox.DualListbox"?>
pkg$
<window apply="pkg$.demo.listbox.dual_listbox.DualComposer">
<!-- Direct Use -->
<dual-listbox id="dualLBox" />
</window>DualComposer.javajava
//package demo.listbox.dual_listbox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zul.ListModelList;
import pkg$.demo.data.PersonData;
import pkg$.demo.data.pojo.Person;
public class DualComposer extends SelectorComposer<Component> {
private static final long serialVersionUID = 8243942703081449079L;
@Wire
private DualListbox dualLBox;
// Handling dualListBox just like origional ZK component
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
dualLBox.setModel(PersonData.getAll());
}
}
v_dual_listbox.zulzul<!-- View of customized component DualListbox -->
<hlayout height="300px" style="padding:10px">
<listbox id="candidateLb" hflex="1" vflex="true" multiple="true" rows="8">
<listhead>
<listheader label="First Name" width="80px"></listheader>
<listheader label="Last Name" width="80px"></listheader>
<listheader label="Full Name"></listheader>
<listheader label="Married" width="60px"></listheader>
</listhead>
<template name="model">
<listitem>
<listcell label="${each.firstName }"/>
<listcell label="${each.lastName }"/>
<listcell label="${each.fullName }"/>
<listcell label="${each.married ? 'Y' : 'N' }"/>
</listitem>
</template>
</listbox>
<zscript><![CDATA[
String imgPath = "/widgets/listbox/dual_listbox/img";
]]></zscript>
<vbox spacing="10px" width="24px">
<image style="cursor:pointer" id="chooseAllBtn" src="${imgPath}/rightrightarrow_g.png" />
<image style="cursor:pointer" id="chooseBtn" src="${imgPath}/rightarrow_g.png" />
<image style="cursor:pointer" id="removeBtn" src="${imgPath}/leftarrow_g.png" />
<image style="cursor:pointer" id="removeAllBtn" src="${imgPath}/leftleftarrow_g.png" />
</vbox>
<listbox id="chosenLb" hflex="1" vflex="true" multiple="true" rows="8">
<listhead>
<listheader label="First Name" width="80px"></listheader>
<listheader label="Last Name" width="80px"></listheader>
<listheader label="Full Name"></listheader>
<listheader label="Married" width="60px"></listheader>
</listhead>
<template name="model">
<listitem>
<listcell label="${each.firstName }"/>
<listcell label="${each.lastName }"/>
<listcell label="${each.fullName }"/>
<listcell label="${each.married ? 'Y' : 'N' }"/>
</listitem>
</template>
</listbox>
<vbox spacing="10px" width="24px">
<image style="cursor:pointer" id="topBtn" src="${imgPath}/upuparrow_g.png" />
<image style="cursor:pointer" id="upBtn" src="${imgPath}/uparrow_g.png" />
<image style="cursor:pointer" id="downBtn" src="${imgPath}/downarrow_g.png" />
<image style="cursor:pointer" id="bottomBtn" src="${imgPath}/downdownarrow_g.png" />
</vbox>
</hlayout>DualListbox.javajava//package demo.listbox.dual_listbox;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.select.Selectors;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zul.Div;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Listbox;
import pkg$.demo.data.pojo.Person;
public class DualListbox extends Div implements IdSpace {
private static final long serialVersionUID = 5183321186606483396L;
@Wire
private Listbox candidateLb;
@Wire
private Listbox chosenLb;
private ListModelList<Person> candidateModel;
private ListModelList<Person> chosenDataModel;
public DualListbox() {
Executions.createComponents("/widgets/listbox/dual_listbox/v_dualListbox.zul", this, null);
Selectors.wireComponents(this, this, false);
Selectors.wireEventListeners(this, this);
chosenLb.setModel(chosenDataModel = new ListModelList<Person>());
chosenDataModel.setMultiple(true);
}
@Listen("onClick = #chooseBtn")
public void chooseItem() {
Events.postEvent(new ChooseEvent(this, chooseOne()));
}
@Listen("onClick = #removeBtn")
public void unchooseItem() {
Events.postEvent(new ChooseEvent(this, unchooseOne()));
}
@Listen("onClick = #chooseAllBtn")
public void chooseAllItem() {
chosenDataModel.addAll(candidateModel);
candidateModel.clear();
}
@Listen("onClick = #removeAllBtn")
public void unchooseAll() {
candidateModel.addAll(chosenDataModel);
chosenDataModel.clear();
}
@Listen("onClick = #topBtn")
public void top() {
Set<Person> selection = new LinkedHashSet<Person>(chosenDataModel.getSelection());
chosenDataModel.removeAll(selection);
chosenDataModel.addAll(0, selection);
chosenDataModel.setSelection(selection);
}
@Listen("onClick = #upBtn")
public void up() {
Set<Person> selection = new LinkedHashSet<Person>(chosenDataModel.getSelection());
if (selection.isEmpty())
return;
int index = chosenDataModel.indexOf(selection.iterator().next());
if (index == 0 || index < 0)
return;
chosenDataModel.removeAll(selection);
chosenDataModel.addAll(--index, selection);
chosenDataModel.setSelection(selection);
}
@Listen("onClick = #downBtn")
public void down() {
Set<Person> selection = new LinkedHashSet<Person>(chosenDataModel.getSelection());
if (selection.isEmpty())
return;
int index = chosenDataModel.indexOf(selection.iterator().next());
if (index == chosenDataModel.size() - 1 || index < 0)
return;
chosenDataModel.removeAll(selection);
chosenDataModel.addAll(++index, selection);
chosenDataModel.setSelection(selection);
}
@Listen("onClick = #bottomBtn")
public void bottom() {
Set<Person> selection = new LinkedHashSet<Person>(chosenDataModel.getSelection());
chosenDataModel.removeAll(selection);
chosenDataModel.addAll(selection);
chosenDataModel.setSelection(selection);
}
/**
* Set new candidate ListModelList.
*
* @param candidate
* is the data of candidate list model
*/
public void setModel(List<Person> candidate) {
candidateLb.setModel(this.candidateModel = new ListModelList<Person>(candidate));
this.candidateModel.setMultiple(true);
chosenDataModel.clear();
}
/**
* @return current chosen data list
*/
public List<Person> getChosenDataList() {
return new ArrayList<Person>(chosenDataModel);
}
private Set<Person> chooseOne() {
Set<Person> set = candidateModel.getSelection();
chosenDataModel.addAll(set);
candidateModel.removeAll(set);
return set;
}
private Set<Person> unchooseOne() {
Set<Person> set = chosenDataModel.getSelection();
candidateModel.addAll(set);
chosenDataModel.removeAll(set);
return set;
}
// Customized Event
public class ChooseEvent extends Event {
private static final long serialVersionUID = -7334906383953342976L;
public ChooseEvent(Component target, Set<Person> data) {
super("onChoose", target, data);
}
}
}PersonData.javajava//package demo.data;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import pkg$.demo.data.pojo.Person;
public class PersonData {
public static final Map<Integer, Person> DUMMY_PERSON_TABLE = new LinkedHashMap<Integer, Person>();
private static volatile int uuid = 0;
static {
Person person = null;
person = new Person(++uuid, "Jabir", "Uilleag", false);
DUMMY_PERSON_TABLE.put(person.getId(), person);
person = new Person(++uuid, "Finbar", "Eetu", true);
DUMMY_PERSON_TABLE.put(person.getId(), person);
person = new Person(++uuid, "Brice", "Cainan", true);
DUMMY_PERSON_TABLE.put(person.getId(), person);
person = new Person(++uuid, "Issy", "Willy", true);
DUMMY_PERSON_TABLE.put(person.getId(), person);
person = new Person(++uuid, "Hugo ", "Wayne", false);
DUMMY_PERSON_TABLE.put(person.getId(), person);
person = new Person(++uuid, "Chelle", "Dinah", true);
DUMMY_PERSON_TABLE.put(person.getId(), person);
person = new Person(++uuid, "Lonnie", "Tarbox", true);
DUMMY_PERSON_TABLE.put(person.getId(), person);
person = new Person(++uuid, "Loraine", "Vassel", false);
DUMMY_PERSON_TABLE.put(person.getId(), person);
}
public static List<Person> getAll() {
return new ArrayList<Person>(DUMMY_PERSON_TABLE.values());
}
}Person.javajava//package demo.data.pojo;
public class Person {
private int id;
private String firstName = "";
private String lastName = "";
private boolean married = false;
public Person() {
}
public Person(Integer id, String firstName, String lastName) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
public Person(Integer id, String firstName, String lastName, boolean married) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.married = married;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public boolean isMarried() {
return married;
}
public void setMarried(boolean married) {
this.married = married;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getFirstName() {
return firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getLastName() {
return lastName;
}
public String getFullName() {
return firstName + " " + lastName;
}
}test.zulzul<zk>
<window border="normal" title="hello" apply="pkg$.TestComposer">
<div>Welcome to ZK Fiddle , run it right now!</div>
<button id="btn" label="Click Me To Evalute Event Binding With Composer" />
</window>
</zk>