From Documentation

Jump to: navigation, search

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

Data Binding Manager is triggered by events, or users' activities. Thus, you must specify events in the ZUML annotation expression with save-when tag expression to tell Data Binding Manager when to save the attribute of the component into the data source.

<component-name attribute-name="@{bean-name.attribute-name,save-when='component-id.event-name'}"/>

  • component-id represents the ID of a UI component
  • event-name represents the event name

Multiple definition is allowed and would be called one by one.

In the following example, Data Binding Manager will save the attribute "value" of Textbox "firstName" into "person.firstName" when the Textbox itself fires "onChange" event.

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

<window width="500px">
		Person person = new Person();

			<listheader label="First Name" width="100px"/>
			<listheader label="Last Name" width="100px"/>
			<listheader label="Full Name" width="100px"/>
				<textbox id="firstName" value="@{person.firstName, save-when='self.onChange'}"/>
				<textbox id="lastName" value="@{person.lastName, save-when='self.onChange'}"/>
			<listcell label="@{person.fullName}"/>

Version History

Last Update : 2011/1/18

Version Date Content

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