-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Shouldnt i be able to select multiple items from a listbox using something like this?
<listbox model="@{referenceData.allergies}" checkmark="true" multiple="true" selectedItems="@{children.allergyType}"> <listitem self="@{each='childAllergy'}" value="@{childAllergy}"> <listcell label="@{childAllergy.description}" /> </listitem> </listbox>
and NOT have to write any java code to get the selected items back set in a Set?
my session attribute children.allergyType is a java Set
shouldnt this be getting populated from the selected items from the listbox?
why is'nt this easy?
why does zk have a listbox component that has multiple attribute you simply have to set to true to allow
multiple selections from the displayed this...
However it appears to be so hard to retrieve those selected items back into your data model!
why is'nt there a demo/docs showing how to do this?
do you really have to write java controller to be able to do this for every multiple selection listbox
within an app?
I'm not sure the question you have, so maybe I should verify it at first.
you have a variable named "children" which is an attribute stored in session, this "children" has a property named "allergyType"( with setter& getter methods).
now you want to bind this "children"'s "allergyType" to listbox's selectedItems, which means every time App User changed his selection of this listbox, the setAllergyType(Set<Listitem>) will be triggered.
is that true?
That is an accurate description of my problem
allergyType is a java Set<AllergyType> and I would like each and every selected allergy type to be populated in this set
I've read that zk listboxes do not support multiple selections and you have to write some java code for type converters and extend listbox itslf to make this work
Cheers
DD
I think implement a converter is what you need to implement as least, I know this part could be a good feature that ZK should implement, maybe you can shoot a feature request.
(I think this is also a good Sample Code to be putted into ZK Studio's sample code)
Do you know of a good example of how to develop a Converter?
Especially if there is one for ListBox
Check also this thread for the "ListitemsConverterV3".
And follow the whole thread for the "community-patches".
This Typeconverter manage n:m relations.
/Robert
Thanks to everyone that has replied on this thread
and finally after a week of trying selectedItems i get my listbox multiple selections working
As I am using zk 5 ee i would have expected this to be working now.
Not wanting to sound ungrateful or anything, zk has such a brilliant look and feel, but this "feature"
of not being able to get multiple selections is a real depressing problem.
I am trying to keep my application as light as possible and having to write my own java code (or actually cut and paste from
robertpic71 :-)) to get the desired result is hurting me.
Thanks again to everyone
DD
Asked: 2010-03-15 13:14:17 +0800
Seen: 3,514 times
Last updated: May 26 '20