myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sunil Tiwari" <sunil.tiw...@tatainfotech.com>
Subject sorting a list of beans containing list
Date Mon, 04 Jul 2005 14:05:11 GMT
Hi,

I need to do sorting on columns in a datatable.
The table is bound to a list of beans.
The bean consists of some simple string variables and some list variables.
I am implementing java.util.Comparator class to do the sorting by using Collections.sort()

I am able to sort the simple columns but the columns which display a list of data are not
being sorted.

for example : column 1 shows list of names and column 2 shows a list of tickets per name i.e
it displays a list of list.
Now, I am able to sort column 1 but not column 2.

Can anyone suggest to implement this?

My sorting code is like this :

GenericComparator gc = new GenericComparator(TrackingDisplayBean.class);

gc.addCriteria(colValue);

gc.setNullValueTop(false);

gc.setDirection(orderBy);

Collections.sort(this.display, gc);

colValue is a variable defined in the bean "TrackingDisplayBean".

If type of colValue is simple datatype like string or integer, its working fine.

but when it is a list of say string, its not working.

Any ideas?

-Sunil

Mime
View raw message