From Documentation

(Difference between revisions)
Jump to: navigation, search
m
Line 46: Line 46:
=Version History=
=Version History=
-
Last Update : {{REVISIONYEAR}}/{{REVISIONMONTH}}/{{REVISIONDAY}}
+
{{LastUpdated}}
{| border='1px' | width="100%"
{| border='1px' | width="100%"
! Version !! Date !! Content
! Version !! Date !! Content

Revision as of 08:02, 17 December 2010






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

<component-name attribute-name="@{bean-name.attribute-name,

load-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, we demonstrate an example that the fullname of a Person will be updated automatically once his/her first name or last name has been modified.

Data Binding Manager will re-load value of Label whose id is fullName, from person.fullName when the either the value of Textbox whose id is firstName or lastName has been changed, in other words, onChange event is triggered.

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

<window>
	<zscript><![CDATA[
	//prepare the example person object
		Person person = new Person();
		person.setFirstName("George");
		person.setLastName("Bush");
	]]>
	</zscript>

	<grid width="400px">
		<rows>
			<row> First Name: 
				<textbox id="firstName" value="@{person.firstName}"/>
			</row>
			<row> Last Name: 
				<textbox id="lastName" value="@{person.lastName}"/>
			</row>
			<row> Full Name: 
				<label id="fullName" value="@{person.fullName,
				load-when='firstName.onChange,lastName.onChange'}"/>
			</row>
		</rows>
	</grid>
</window>

Version History

Last Update : 2010/12/17


Version Date Content
     




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