Home   Single Page

データバィンディングマネージャーのアクセス権限の定義

データバィンディングをより良くコントロールする為に、 component-name の attribute-name のアクセスモードを both(ロード/セーブ), load(ロードのみ), save(セーブのみ), もしくは none(どちらでもない)などに設定出来ます。 .

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

複数の定義は許されません。そして後からの定義は以前の定義を上書きします。

以下のサンプルでは "firstName"と "lastName"のTextboxに変更が加えられても、Listcell の "fullname"の Listcell の value は変化がありません。なぜなら、データバィンディングマネージャはその value を更新してはいけないと指示されているからです.

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

<window width="500px">
<zscript>
    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>