myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lightbulb432 <>
Subject Re: Can dataTable's value be a HashSet?
Date Wed, 17 Jan 2007 17:35:09 GMT

Is it possible to plug in a Comparator to the dataTable operation somehow to
enable a Set to be sorted based on that Comparator?

In fact, this could be used as a sorting mechanism for any collection,
couldn't it? Does such functionality exist? (I couldn't find anything in the
Javadoc to indicate so.)

Simon Kitching-3 wrote:
> And in general sets are not ordered, which doesn't make sense when 
> displaying data in a table. Read-only tables would be odd, but 
> implementing editable tables would be really nasty if the server-side 
> data structure that the table corresponds to could return its data in 
> any order.
> The JSF spec explicitly lists what collections are supported for UIData, 
> and Set is not one of them.
> Cagatay Civici wrote:
>> Hi,
>> It's not supported by UIData, because sets are not indexed.
>> The workaround would be the wrapper you mentioned or a custom property 
>> resolver;
>> Cagatay
>> On 1/14/07, *lightbulb432* < 
>> <>> wrote:
>>     Can the value attribute of a h:dataTable be set to any Collection? I
>>     tried
>>     setting it to a Set (specifically, HashSet), but that gave trouble.
>>     To solve
>>     this, I added another property to the backing bean which simply
>>     wrapped that
>>     bean's Set in a List and used that as the value attribute, and then
>> it
>>     worked fine!
>>     What is the reason that Sets/HashSets aren't allowed to be used? I
>>     sure hope
>>     there's a way to get it work, as many of my Collections are Sets and
>> I
>>     wouldn't like to clutter my code with List wrappers just to make
>>     this work.
>>     --
>>     View this message in context:
>>     Sent from the MyFaces - Users mailing list archive at
>>     <>.

View this message in context:
Sent from the MyFaces - Users mailing list archive at

View raw message