From Documentation

Jump to: navigation, search

Stop.png This documentation is for an older version of ZK. For the latest documentation please click here.

One data source could be associated with multiple UI components. Once the data source had been modified, those associated UI components will be updated automatically by Data Binding Manager.

In the following example. we use ZUML annotation expression to associate a data source, a Person instance, "selected" with multiple UI components, including Listbox, and Grid. Once the user selects an item in the Listbox, the Grid will display information of the selected person accordingly.

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>

<window width="500px">
		//prepare the example person
		Person selected = new Person();

	<listbox rows="4" selectedItem="@{selected}">
			<listheader label="First Name" width="100px" />
			<listheader label="Last Name" width="100px" />
			<listheader label="Full Name" width="100px" />
			<listcell label="George" />
			<listcell label="Bush" />
			<listcell label="Bill" />
			<listcell label="Gates" />
	<!-- show the detail of the selected person -->
				First Name:
				<textbox value="@{selected.firstName}" />
				Last Name:
				<textbox value="@{selected.lastName}" />

Version History

Last Update : 2011/1/18

Version Date Content

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.