@init
From Documentation
Revision as of 09:58, 8 February 2012 by Hawk (talk | contribs) (moved ZK Developer's Reference/MVVM/Syntax/DataBinding/@init to ZK Developer's Reference/MVVM/Syntax/Data Binding/@init)
Syntax
@init( [EvaluateOnce 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>