New Features of ZK 6.0.1"

From Documentation
m
Line 9: Line 9:
 
  {{ZK PE and EE}}
 
  {{ZK PE and EE}}
  
Reference binding allows us to reference an EL expression with a customized name. We can use this reference in another EL expression nested in the component that is binded to this reference. Typically, we use reference binding to shorten expressions or to modularize the view<ref>When using this feature, you have to avoid saving to a first-term only expression, read [http://books.zkoss.org/wiki/ZK_Developer%27s_Reference/MVVM/Data_Binding/Property_Binding#Limitation here] for more detail.</ref>.
+
Reference binding allows us to reference an expression with a customized name. We can use this reference in another EL expression nested in the component that is binded to this reference.
  
Steps to use this feature:
+
A simple example is as follows:
# Bind a custom attribute on a component with <tt> @ref </tt>.
 
# Use the custom attribute in other EL expressions that are nested in children components
 
  
 
<source lang="xml" high="3,5,8">
 
<source lang="xml" high="3,5,8">
Line 31: Line 29:
 
</source>
 
</source>
  
As shown in the example above, we add a reference <tt>@ref</tt> to '''vm.person''' with a name '''p''' to <i>vlayout</i>. This way, '''p'''  inside the <i>vlayout</i> can be used by other EL expressions.
+
Steps to use this feature:
 +
# Bind a custom attribute on a component with <tt> @ref </tt>.
 +
# Use the custom attribute in other EL expressions that are nested in children components
 +
 
 +
The above code shows these implemented steps, for more information and more uses please visit the [[ZK_Developer's_Reference/MVVM/Data_Binding/Reference_Binding developer's reference]].
  
 
=Download & other resources=
 
=Download & other resources=

Revision as of 04:48, 27 April 2012

DocumentationSmall Talks2012MayNew Features of ZK 6.0.1
New Features of ZK 6.0.1

Author
Timothy Clare, Potix Corporation
Date
April 2, 2012
Version
ZK 6.0.1

Reference Binding

  • Available for ZK:
  • http://www.zkoss.org/product/zkhttp://www.zkoss.org/whyzk/zkeeVersion pe-ee.png

Reference binding allows us to reference an expression with a customized name. We can use this reference in another EL expression nested in the component that is binded to this reference.

A simple example is as follows:

<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>

Steps to use this feature:

  1. Bind a custom attribute on a component with @ref .
  2. Use the custom attribute in other EL expressions that are nested in children components

The above code shows these implemented steps, for more information and more uses please visit the ZK_Developer's_Reference/MVVM/Data_Binding/Reference_Binding developer's reference.

Download & other resources


Comments



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