Just in case somebody might read this:

The solution for my problem was to use a column Comparator instead of
Decorator. 
And I'm using fn:length from jstl function to get the size of a collection.


cause wrote:
> 
> Hi,
> I have a column in a table that is mapped to a collection. I want this
> column to display a number of items in this collection, so I'm using a
> decorator for this column that returns the collection size. 
> While it displays what is needed, when I'm trying to sort this column it
> gives some unpredictable and inconsistent results. Perhaps it's just not
> the best way to accomplish what I want or there is something I'm doing
> wrong. Anyway any halp would be appreciated. 
> Here is the code:
> 
> in my jsp:
> ...
> 
> <display:column property="items" title="${itemsTitle}" sortable='true'
>                                
> decorator="com.util.ItemsNumberFieldDecorator"/>
> ...
> 
> decorator:
> 
>     public Object decorate(Object object, PageContext pageContext,
> MediaTypeEnum mediaTypeEnum) throws DecoratorException {
>         Collection itemsCollection;
>          try {
>             itemsCollection = (Collection)object;
>         } catch (ClassCastException e) {
>             return 0;
>         }
>         if(itemsCollection != null){
>             return itemsCollection.size();
>         }
>         return 0;
>     }
> 

-- 
View this message in context: 
http://www.nabble.com/Sorting-problem-tp19875691p19914391.html
Sent from the DisplayTag - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to