-
1. Re: rich:listShuttle always returns an empty list in targetS
nbelaevski Oct 19, 2008 6:47 PM (in response to nimo22)Hi,
targetSelection represents set of items selected by the user in the target (right) list but not the set of the items that target list contains. Use targetValue to get the set of the items in the target list. -
2. Re: rich:listShuttle always returns an empty list in targetS
nimo22 Oct 20, 2008 12:19 PM (in response to nimo22)Hello nbelaevski,
thank you! That was my fault. I changed it to targetValue and now it works.
Besides, I have also successfully integrated a converter with a Entity . All works fine!
One thing, I don t understand:
Do you know, how can I group the items in the boxes?
For example, I have a row containing the columns: Gender and Name.
Now, I want to group the rows by Gender or show only the rows which gender are female.
I have tried that with rich:column filterBy=.., but this does not work:<rich:listShuttle sourceValue="#{myBean.availablePersons}" targetValue="#{myBean.selectedPersons}" var="person" converter="myConverter"> <rich:column filterBy="#{person.gender}" filterEvent="onkeyup"> <f:facet name="header"> <h:outputText value="Gender" /> </f:facet> <h:outputLabel value="#{person.gender}"/> </rich:column> <rich:column> <f:facet name="header"> <h:outputText value="Name" /> </f:facet> <h:outputLabel value="#{person.name}"/> </rich:column> </rich:listShuttle>
How would you do that?
How can I do that?
With a h:selectBox in the first row or should I integrate a rich:tree into the shuttleBox?
I have no clue. -
3. Re: rich:listShuttle always returns an empty list in targetS
nbelaevski Oct 21, 2008 6:37 AM (in response to nimo22)Hi,
filterBy works for rich:dataTable only. I think it's not a good idea to integrate rich:tree into listShuttle.
You should do grouping and filtering on the server by changing sourceValue and targetValue collections respectively. You can hide/show rich:column using "rendered" attribute. -
4. Re: rich:listShuttle always returns an empty list in targetS
nimo22 Oct 21, 2008 12:49 PM (in response to nimo22)hey you,
I have done it successfully...done grouping and filtering on the server by changing sourceValue and targetValue..all works fine.
hmm..now I have a question about rich:listShuttles sourceSelection/targetSelection-Property:<rich:listShuttle sourceValue="#{myBean.sourceItems}" targetValue="#{myBean.targetItems}" sourceSelection="#{myBean.sourceItemsSelections}" targetSelection="#{targetItemsSelections}" var="item" converter="myItemConverter">
I can get/set all values of the source-box (left side) via 'myBean.sourceItems' and can get/set all values of the target-box (right side) via 'myBean.targetItems'. This works.
But my sourceSelection and targetSelection does not work:
After I pick a item from the source-box to the target-box, I would expect, that this item is stored in my sourceSelection and vice versa. Indeed, I can get all the items of a side via source/targetValue, but I need only these items which are transfered from one box to another.
Afer submitting the form, the lists declared in sourceSelection and targetSelection are always empty, even I had selected items from one side to another. Do you know, why?
According to the Richfaces-manual (rich:listShuttle):sourceSelection:Manages selection in a source list from the server side
targetSelectin:Manages selection in a target list from the server side
Have I anything misunderstood about the meaning of source/targetSelection? -
5. Re: rich:listShuttle always returns an empty list in targetS
nbelaevski Oct 21, 2008 5:54 PM (in response to nimo22)Let me explain by simple example. Please click the first item e.g. in source list then press Shift and click the last item of the list. You'll see all items in the list are now selected (they've got another background color if you not redefined skinning). Do not move them! Submit the form - you should see that sourceSelection is not empty now.
-
6. Re: rich:listShuttle always returns an empty list in targetS
nimo22 Oct 22, 2008 11:22 AM (in response to nimo22)Hey,
yes..now I understand the meaning of sourceSelection/targetSelection (works such as the selection of a typical listbox).
I have activated the property "switchByClick="true". So sourceSelection/targetSelection was always empty :-)
But look at this scenario:
After I transfer a item from the source-box to the target-box, I want to store exactly this item in a separate list. I have integrated the a4j:support into my rich:listShuttle:<rich:listShuttle sourceValue="#{myBean.availablePersons}" targetValue="#{myBean.selectedPersons}" var="person" converter="myConverter"> <rich:column filterBy="#{person.gender}" filterEvent="onkeyup"> <f:facet name="header"> <h:outputText value="Gender" /> </f:facet> <h:outputLabel value="#{person.gender}"/> </rich:column> <rich:column> <f:facet name="header"> <h:outputText value="Name" /> </f:facet> <h:outputLabel value="#{person.name}"/> </rich:column> <a4j:support event="onlistchanged" action="#{myBean.storeItemInList(person)}"/> </rich:listShuttle>
..but the person in storeItemInList(person) is always null:public void storeItemInList(Person person) { this.transferedItems.add(person); }
How can I access only these items which aretransfered
from one box to the other?
Should I do a typical loop of the targetList and look, which items are added or can I do it in a better way ? -
7. Re: rich:listShuttle always returns an empty list in targetS
sunay Apr 22, 2010 8:07 AM (in response to nimo22)rather then this
<a4j:support event="onlistchanged" action="#{myBean.storeItemInList(person)}"/>
do like
<a4j:support event="onlistchanged" reRender="defaultCombo" />this would have the changed value
one thing i want to ask is why you want to crate new list , you can automatically get it into the targetValue list , you need to keep listShuttle in form tag then only you list will be updated .... go through demo example given for listShuttle updating the toolbar
Thanks
Sunay