Revision history [back]

click to hide/show revision 1
initial version

answered 2016-06-14 10:27:58 +0800

MDuchemin gravatar image MDuchemin

ZK Team

Hi William,

The main difference would be that @init() requires a Binder or BinderComposer.

While they are both cheap, ${} is a tiny bit cheaper since there is no memory overhead. Unless you have extremely large amounts of Expressions in a context, the difference should not be noticeable.

As you mentioned, @init() happen during bind, which is after zul parsing. ${} are evaluated during parsing. Due to this, you can reference a component further down a zul page in @init, but not in ${}.

Otherwise, they provide the same function: one-time evaluation of an expression during page initialization, without maintaining a tracking entry afterward.

PS: that's a good addition to the do's and don't, so I will also reply there ;-) Regards, Matt

Hi William,

The main difference would be that @init() requires a Binder or BinderComposer.BindComposer.

While they are both cheap, ${} is a tiny bit cheaper since there is no memory overhead. Unless you have extremely large amounts of Expressions in a context, the difference should not be noticeable.

As you mentioned, @init() happen during bind, which is after zul parsing. ${} are evaluated during parsing. Due to this, you can reference a component further down a zul page in @init, but not in ${}.

Otherwise, they provide the same function: one-time evaluation of an expression during page initialization, without maintaining a tracking entry afterward.

PS: that's a good addition to the do's and don't, so I will also reply there ;-) Regards, Matt

Edit: corrected the obvious classname error BinderComposer > BindComposer

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More