@save
From Documentation
Revision as of 09:58, 8 February 2012 by Hawk (talk | contribs) (moved ZK Developer's Reference/MVVM/Syntax/DataBinding/@save to ZK Developer's Reference/MVVM/Syntax/Data Binding/@save)
Syntax
@save( [EL-expression], [conditionKeyword]=[EvaluateOnce EL-expression] )
Description
Target Attribute: any save-allowed attributes (except viewModel, validationMessages)
Purpose: Restrict binder to save data to ViewModel only, not load.
You usually use this syntax when you want to save and load data in different conditions, you should write both @save and @load in an attribute. You have to use it in form binding to save upon a command.
- [conditionKeyword]=[EvaluateOnce EL-expression]
- This expression is optional unless you want to save or load upon a command.
- [conditionKeyword]
- It could be one of [ before | after ]
- [EvaluateOnce EL-expression]
- The evaluation result must be one or more command name.
- Command name must correspond to the name specified in Java annotation @Command in a ViewModel.
Example
Basic usage
<textbox value="@load(vm.person.name) @save(vm.person.name, before='save')"/>
<textbox value="@load(vm.person.name) @save(vm.person.name, before={'save', 'update'})"/>
Saving and loading form attribute'
<textbox value="@save(vm.number) @load(vm.number, after='cmd')" />