Reference Binding
From Documentation
Revision as of 03:36, 3 March 2012 by Dennischen (talk | contribs) (Created page with "{{ZKDevelopersReferencePageHeader}} {{Template:UnderConstruction}} __TOC__ Since 6.0.1 Reference binding allows us to make a reference for a EL expression with a custom name...")
Since 6.0.1
Reference binding allows us to make a reference for a EL expression with a custom name. The reference could be referred in another EL expression (Have to nested in the component has this reference binding). Typically we use reference binding to make expression shorter or modularize the view.
Steps to use this feature:
- Bind a custom attribute on a component with @ref .
- Use the custom attribute in the EL expression that nested in children component
Basic usage example
<window apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('foo.MyVM')">
<vlayout p="@ref(vm.person)">
<hlayout>
First Name: <textbox value="@bind(p.firstName)" />
</hlayout>
<hlayout>
Last Name: <textbox value="@bind(p.lastName)" />
</hlayout>
</vlayout>
</window>
Moudlarize view example
<window apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('foo.MyVM')">
<include p="@ref(vm.person1)" src="person.zul"/>
<include p="@ref(vm.person2)" src="person.zul"/>
</window>
Moudlarize view example - person.zul
<vlayout>
<hlayout>
First Name: <textbox value="@bind(p.firstName)"/>
</hlayout>
<hlayout>
Last Name: <textbox value="@bind(p.lastName)"/>
</hlayout>
</vlayout>
Version History
Version | Date | Content |
---|---|---|
6.0.1 | May 2012 | The new reference-binding feature. |