-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi Guys
Yesterday I played around with Listbox and it's possibilities to add model/data.(see here)
I ended up with using AnnotateDataBinderInit and here is my current problem:
I've two Listboxes, both are being connected with different lists of Bean objects.
<listbox id="inputListbox" mold="select" model="@<composer.allInput>"> <listitem self="@{each=objects}" value="@{objects}"> <listcell label="@{objects.name}"/> </listitem> </listbox> <listbox id="typeListbox" mold="select" model="@<composer.allTypes>"> <listitem self="@{each=objects}" value="@{objects}"> <listcell label="@{objects.name}"/> </listitem> </listbox>
Now there is an onSelect Callback on inputListbox. When this is being called (when the selected item changes) I also want to change the typeListbox accordingly because the bean "input" has an foreign key to "type".
Now the problem is - it is easy to set an Listboxes index, but in my case ID != index.
The (complex) solution I thought about is to
1.) Get the Input Bean Object in onSelect and get the foreign key (ID of "type")
2.) Get all Listitems from typeListBox
3.) Iterate throu them and see which one matches the foreign key (ID)
4.) Remember the index of the matching ID
5.) Set this Index on typeListBox
This looks kind of ugly to me - any other ideas how to solve this?
Regards
juergenmw
Asked: 2012-05-24 08:31:38 +0800
Seen: 139 times
Last updated: May 24 '12