-
1. Re: orderingList: How to get new order?
mangelo123 Mar 8, 2008 8:15 PM (in response to mhassel)Can JBoss reply to this please? I have the exact same need. I find it odd that this control allows you to re-order the list, but then have no way to get at the ordered list.
Please help. -
2. Re: orderingList: How to get new order?
mhassel Mar 10, 2008 4:13 PM (in response to mhassel)I actually figured it out by looking at the component source code: List a lot of things with RichFaces, as soon as things go beyond "hello world". ii ts badly or not at all documented.
Basically all you have to do is write a custom converter for the objects you are displaying in your list. This is actually redundant and should not be necessary, but hey...
The reordered list is then available through the property-setter referenced in the value expression.
Feel free to contact me off -list if you want a code example... -
3. Re: orderingList: How to get new order?
ajorcin Aug 4, 2008 2:31 PM (in response to mhassel)hello,
can you give me an example code to get de new order from a list??
thanks -
4. Re: orderingList: How to get new order?
baranjsf Aug 1, 2010 5:45 PM (in response to ajorcin)Hi there,
I have one orderinglist, but I could not get the new order in my backing bean. Would you plz help me?
It is my ordering list:
My rankList will be initialized in init() method in my backing bean:
rankList = new ArrayList<Rank>(); rankList.add(new Rank("Alabama Montgomery")); rankList.add(new Rank("Alaska Juneau")); rankList.add(new Rank("Arizona Phoenix")); rankList.add(new Rank("Arkansas Little Rock")); rankList.add(new Rank("California Sacramento")); rankList.add(new Rank("Colorado Denver")); rankList.add(new Rank("Connecticut Hartford")); rankList.add(new Rank("Delaware Dover")); rankList.add(new Rank("Florida Tallahassee")); rankList.add(new Rank("Georgia Atlanta")); rankList.add(new Rank("Hawaii Honolulu")); rankList.add(new Rank("Idaho Boise"));
and it is my findEperts method in my backing bean:
public void findExperts (){
System.out.println("FIND EXPERT:Hi"+rankList);
resultsList.clear();
BusinessLogic bs = new BusinessLogic();
resultsList = bs.search(searchedTopicList);
}and it is my convertor:
public class StringToRankListConverter implements Converter { public Object getAsObject(FacesContext context, UIComponent component, String value) { System.out.println("StringToRankListConverter value: "+value.toString()); String[] words = value.split (":"); String name = words[0]; Rank wonder = new Rank(name); return wonder; } public String getAsString(FacesContext context, UIComponent component, Object value) { return value.toString(); } }
Sometimes a4j:support calls my findexperts method, and sometimes does not call. But I saw in my setRankList and getrankList and findExpert method that the rankList has the old order, not a new order.
Thank in advance
-
5. Re: orderingList: How to get new order?
uqux Oct 22, 2010 9:12 AM (in response to baranjsf)Hi,
Here's a good example resource .. check it out http://code.google.com/p/richfaces-examples/source/detail?r=7d4874785e155aac0991f3cf7d75d55706f9d9f9#
It really works.. I got the same problem than you .. to get the ordered list in your backing bean you need to send the ordering list via commandbutton or via a4j:commandbutton in this case a4j be sure to put ajxSingle="false". Remember the reOrder is happening in the client side..
Good Luck!
-
6. Re: orderingList: How to get new order?
ilya_shaikovsky Oct 25, 2010 4:34 AM (in response to mhassel)http://livedemo.exadel.com/richfaces-demo/richfaces/orderingList.jsf working sample. http://jboss.org/richfaces/demos - sources with Bean code available in svn.
unfortunatelly about the doc's you're right. there should be information that comonent requires custom converter for objects. I will add to FAQ https://jira.jboss.org/browse/RFPL-880