@init"

From Documentation
Line 27: Line 27:
  
  
''Usage example in form attribute'''
+
'''Usage example in form attribute'''
 
<source lang="xml" >
 
<source lang="xml" >
  
Line 34: Line 34:
  
 
</source>
 
</source>
 
 
 
  
 
=Version History=
 
=Version History=

Revision as of 07:26, 3 January 2013


Syntax

@init( [EvaluateOnce EL-expression], [arbitraryKey]=[EL-expression] )

Description

Target Attribute: any

Purpose: Initialize an attribute's value and no reload during user interaction.

The EL expression in this annotation is only evaluated once when binder parses it. When you use it in "viewModel" attribute, binder will try to resolve the EL expression as a class and create an instance of it.

In "form" attribute, the result of evaluating the EL expression should be a Form object.

For other attributes, binder initializes their value with EL evaluation result.

Example

Usage example in viewModel attribute

<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('foo.ChildrenMenuVM')" >
</window>


Usage example in form attribute

<vbox form="@id('fx') @init(vm.myForm) @load(vm.person) @save(vm.person, before='save')">
</vbox>

Version History

Last Update : 2013/01/03


Version Date Content
6.0.0 February 2012 The MVVM was introduced.




Last Update : 2013/01/03

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