-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Is it possible to declare multiple variable resolvers in a zul ? if yes how can this be done ?
https://www.zkoss.org/wiki/ZUMLReference/ZUML/ProcessingInstructions/variable-resolver
"You can specify multiple variable resolvers with multiple variable-resolver directives..."
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 ?
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).
Asked: 2021-03-03 20:49:45 +0800
Seen: 14 times
Last updated: Mar 10 '21
bug with intboxes on mobile devices
zk keikai-how to add custom button/label to formulabar?
zk-keikai- update multiple cells parallel at same time asynchronously
zk-keikai-How to auto fit column width based on text
zk-keikai-ClipboardPateEvent-called twice
Reference a spring bean from VariableResolver