-
FEATURED COMPONENTS
First time here? Check out the FAQ!
![]() | 1 | initial version | |
Your problem is not with variable resolver but rather the fact that your model contains different object than the selected value (which I assume is just a number (short))
So here my take on your scenario as a runnable ZK fiddle:
https://zkfiddle.org/sample/1002pcs/1-listbox-item-selection
Instead of your GenericLov
I simply use a LinkedHashMap
which is essentially the same.
Then I make sure the model contains only the Short numbers (which is the selected value as well), the display label is converted from Short
to String
using a @converter
(For convenience I defined a read only converter for display purposes).
I expose both the list of countryCodes
and the countryDisplayConverter
via VariableResolver
.
However a variable resolver is not necessary here (you could simply have getters on the viewmodel returning the list of country codes and the converter).
I hope this helps, feel free post a modified version of the example in case you have further questions.
![]() | 2 | No.2 Revision |
Your problem is not with variable resolver but rather the fact that your model contains different object than the selected value (which I assume is just a number (short))
So Since you didn't provide any error messages or runnable code I can't comment on why things are not working in your attempt.
Instead here my take on your scenario as a runnable ZK fiddle:
https://zkfiddle.org/sample/1002pcs/1-listbox-item-selection
Instead of your GenericLov
I simply use a LinkedHashMap
which is essentially the same.
Then I make sure the model contains only the Short numbers (which is the selected value as well), the display label is converted from Short
to String
using a @converter
(For convenience I defined a read only converter for display purposes).
I expose both the list of countryCodes
and the countryDisplayConverter
via VariableResolver
.
However a variable resolver is not necessary here (you could simply have getters on the viewmodel returning the list of country codes and the converter).
I hope this helps, feel free post a modified version of the example in case you have further questions.