0

declare multiple variable resolver in a zul

asked 2021-03-03 20:49:45 +0800

RomanZK gravatar image RomanZK
1 1

Is it possible to declare multiple variable resolvers in a zul ? if yes how can this be done ?

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2021-03-05 13:04:44 +0800

jeanher gravatar image jeanher
1814 2 6
ZK Team

https://www.zkoss.org/wiki/ZUMLReference/ZUML/ProcessingInstructions/variable-resolver

"You can specify multiple variable resolvers with multiple variable-resolver directives..."

link publish delete flag offensive edit

answered 2021-03-09 00:57:02 +0800

RomanZK gravatar image RomanZK
1 1

Thanks for the response.

How does zk know which one to use ? Does it attempt them one by one ?

I just want to understand how ZK will behave when it sees multiple variable declarations

Also is it possible to explicitly state the resolver to use in a zul page for a particular component ?

link publish delete flag offensive edit

answered 2021-03-10 11:26:12 +0800

cor3000 gravatar image cor3000
5833 2 7
ZK Team

updated 2021-03-10 11:27:19 +0800

How does zk know which one to use ? Does it attempt them one by one ?

yes it goes through the list of all variable resolvers. The first one returning the first non-null value.

You can add a breakpoint in PageImpl#getXelVariable to see what resolvers are defined at page level - and in which order they are processed.

There can be additional VariableResolvers not defined a page level that also take part in the variable resolution.

Also is it possible to explicitly state the resolver to use in a zul page for a particular component ?

In a page you define a specific VariableResolver for the whole page (not per component).

Still you can add custom attributes for a specific component. There will be a built-in variable resolver also looking into the component scoped variables. Or you can split your zul code into multiple files having different variable-resolvers configured.

In the end it might just be that variable resolver isn't the perfect tool for your requirements/goals you're trying to achieve. In case you can give some details about those there is maybe a different way to implement those (e.g. the mentioned custom-attributes).

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2021-03-03 20:49:45 +0800

Seen: 14 times

Last updated: Mar 10

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