@id"
(Created page with "{{ZKDevelopersReferencePageHeader}} =Syntax= <tt> @id( </tt> ''[EvaluateOnce EL-expression]'' <tt> )</tt> = Description = '''Target Attribute:''' viewModel, form, validation...") |
m ((via JWB)) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ZKDevelopersReferencePageHeader}} | {{ZKDevelopersReferencePageHeader}} | ||
+ | {{Deprecated | url=[http://books.zkoss.org/zk-mvvm-book/8.0/syntax/id.html zk-mvvm-book/8.0/syntax/data_binding/id]|}} | ||
=Syntax= | =Syntax= | ||
− | < | + | <code>@id(</code> ''[EvaluateOnce EL-expression]'' <code>)</code> |
= Description = | = Description = | ||
Line 17: | Line 18: | ||
When we use it in "form" attribute, it gives an id to reference form's middle object. | When we use it in "form" attribute, it gives an id to reference form's middle object. | ||
Form status variable's naming is: | Form status variable's naming is: | ||
− | < | + | <code> |
[middleObjectId]Status | [middleObjectId]Status | ||
− | </ | + | </code> |
= Example = | = Example = | ||
Line 36: | Line 37: | ||
</grid> | </grid> | ||
</source> | </source> | ||
+ | |||
+ | |||
+ | |||
+ | =Version History= | ||
+ | |||
+ | {| class='wikitable' | width="100%" | ||
+ | ! Version !! Date !! Content | ||
+ | |- | ||
+ | | 6.0.0 | ||
+ | | February 2012 | ||
+ | | The MVVM was introduced. | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
{{ZKDevelopersReferencePageFooter}} | {{ZKDevelopersReferencePageFooter}} |
Latest revision as of 07:35, 8 July 2022
This article is out of date, please refer to zk-mvvm-book/8.0/syntax/data_binding/id for more up to date information.
Syntax
@id(
[EvaluateOnce EL-expression] )
Description
Target Attribute: viewModel, form, validationMessages
Purpose: To give an id to current binding target which can be used to reference its properties in the binding annotation of child components.
We suggest you to use a string literal in EL expression. Because binder only evaluate this annotation's EL expression once to determine ViewModel's id, and this EL expresion is also used in other child component's ZK bind annotation. If it's not a fixed value, it will cause incorrect evaluation result.
When we use it in "validationMessages" attribute, it gives an id to reference validation message holder.
When we use it in "form" attribute, it gives an id to reference form's middle object.
Form status variable's naming is:
[middleObjectId]Status
Example
Usage in viewModel attribute
<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('foo.ChildrenMenuVM')"
validationMessages = "@id('vmsgs')" >
</window>
Usage in form attribute
<grid form="@id('fx') @load(vm.user) @save(vm.user,before='register')">
</grid>
Version History
Version | Date | Content |
---|---|---|
6.0.0 | February 2012 | The MVVM was introduced. |