Define the Access Privilege of Data Binding Manager"

From Documentation
m
Line 15: Line 15:
 
In the following example, if the value of <tt>Textbox</tt>, "<tt>firstName</tt>", and "<tt>lastName</tt>" has been modified, the value of <tt>Listcell</tt>, "<tt>fullname</tt>", will remain unchanged because Data Binding manager is informed not to update its value.
 
In the following example, if the value of <tt>Textbox</tt>, "<tt>firstName</tt>", and "<tt>lastName</tt>" has been modified, the value of <tt>Listcell</tt>, "<tt>fullname</tt>", will remain unchanged because Data Binding manager is informed not to update its value.
  
<source lang="xml" >
+
<source lang="xml" high="25">
 
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
 
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
  
Line 40: Line 40:
 
</listcell>
 
</listcell>
 
<listcell id="fullName"
 
<listcell id="fullName"
label="@{person.fullName, access='none'}" />
+
label="@{person.fullName, access='load'}" />
 
</listitem>
 
</listitem>
 
</listbox>
 
</listbox>

Revision as of 01:25, 17 May 2011


DocumentationZK Developer's ReferenceData BindingDefine the Access Privilege of Data Binding Manager
Define the Access Privilege of Data Binding Manager


For better control of data-binding manager, you can set the access mode of the attribute-name of the component-name to be.

  • both - load/save
  • load - load Only
  • save - save Only
  • none - neither

<component-name attribute-name="@{bean-name.attribute-name,access='type-name'}"/>

  • type-name represents a certain kind of access mode

Multiple definition is NOT allowed and the later defined would override the previous defined one. 

In the following example, if the value of Textbox, "firstName", and "lastName" has been modified, the value of Listcell, "fullname", will remain unchanged because Data Binding manager is informed not to update its value.

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

<window width="500px">
	<zscript><![CDATA[  
	    Person person = new Person();
	    person.setFirstName("Bill");
	    person.setLastName("Gates");
    ]]>
	</zscript>

	<listbox>
		<listhead>
			<listheader label="First Name" width="100px" />
			<listheader label="Last Name" width="100px" />
			<listheader label="Full Name" width="100px" />
		</listhead>
		<listitem>
			<listcell>
				<textbox id="firstName" value="@{person.firstName}" />
			</listcell>
			<listcell>
				<textbox id="lastName" value="@{person.lastName}" />
			</listcell>
			<listcell id="fullName"
				label="@{person.fullName, access='load'}" />
		</listitem>
	</listbox>
</window>

Version History

Last Update : 2011/05/17


Version Date Content
     



Last Update : 2011/05/17

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