Define the Access Privilege of Data Binding Manager"

From Documentation
 
Line 1: Line 1:
{{ZKDevelopersReferencePageHeader}}
+
#REDIRECT [[ZK Developer's Reference/MVVM/Data Binding]]
 
 
For better control of the Data-Binding Manager, you can set the access mode of the attribute-name of the component-name to be:
 
*<tt>both</tt>  - load/save
 
*<tt>load</tt> - load Only
 
*<tt>save</tt> - save Only
 
*<tt>none</tt> - neither
 
 
 
<tt><component-name attribute-name="@{bean-name.attribute-name,access='type-name'}"/></tt>
 
 
 
* <tt>type-name</tt> represents a certain kind of access mode
 
 
 
Multiple definition is NOT allowed and the later defined would override the previous defined one.&nbsp;
 
 
 
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 the Data Binding manager will be informed not to update its value.
 
 
 
<source lang="xml" high="25">
 
<?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>
 
</source>
 
 
 
=Version History=
 
{{LastUpdated}}
 
{| border='1px' | width="100%"
 
! Version !! Date !! Content
 
|-
 
| &nbsp;
 
| &nbsp;
 
| &nbsp;
 
|}
 
 
 
{{ZKDevelopersReferencePageFooter}}
 

Latest revision as of 03:53, 10 February 2012