Processing...
Description & Source Code

The listbox component can automatically generate checkboxes or a radio buttons for selecting its list items by setting its attributes.

For allowing the selection of a single list item only, set checkmark="true", and each list item would be annotated with a radio button. For allowing the selection of multiple list items, set multiple="true". Please refer to the source code.

multiple_selection.zul
<zk>
	<listbox id="box" multiple="true" checkmark="true">
		<listhead>
			<listheader label="Name" />
			<listheader label="Gender" />
			<listheader label="Age" />
		</listhead>
		<listitem>
			<listcell label="Mary" />
			<listcell label="FEMALE" />
			<listcell label="18" />
		</listitem>
		<listitem>
			<listcell label="John" />
			<listcell label="MALE" />
			<listcell label="20" />
		</listitem>
		<listitem>
			<listcell label="Jane" />
			<listcell label="FEMALE" />
			<listcell label="32" />
		</listitem>
		<listitem>
			<listcell label="Henry" />
			<listcell label="MALE" />
			<listcell label="29" />
		</listitem>
    <listitem>
      <listcell label="Mark" />
      <listcell label="MALE" />
      <listcell label="15" />
    </listitem>
    <listitem>
      <listcell label="Jeffery" />
      <listcell label="MALE" />
      <listcell label="17" />
    </listitem>
    <listitem>
      <listcell label="Rebecca" />
      <listcell label="FEMALE" />
      <listcell label="21" />
    </listitem>
	</listbox>
</zk>
ctrl.zul
<vlayout>
	<checkbox label="Enable checkmark" checked="true" onCheck="box.checkmark = self.checked"/>
	<checkbox label="Multiple selection" checked="true" onCheck="box.multiple = self.checked"/>
</vlayout>