Define the Access Privilege of Data Binding Manager"

From Documentation
m (Created page with '{{ZKDevelopersGuidePageHeader}} For better control of data-binding manager, you can set the access mode of the attribute-name of the component-name to be <tt>both</tt>(load/save…')
 
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{ZKDevelopersGuidePageHeader}}
+
#REDIRECT [[ZK Developer's Reference/MVVM/Data Binding]]
 
 
For better control of 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), or <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 Data Binding manager is informed not to update its value.
 
 
 
<source lang="xml" >
 
<?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='none'}" />
 
</listitem>
 
</listbox>
 
</window>
 
</source>
 
 
 
{{ ZKDevelopersGuidePageFooter}}
 

Latest revision as of 03:53, 10 February 2012