myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lightbulb432 <veerukrish...@hotmail.com>
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;
>> 
>> http://www.jroller.com/page/mert?entry=settolistpropresolver_for_jsf_el
>> 
>> Cagatay
>> 
>> On 1/14/07, *lightbulb432* < veerukrishnan@hotmail.com 
>> <mailto:veerukrishnan@hotmail.com>> 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:
>>    
>> http://www.nabble.com/Can-dataTable%27s-value-be-a-HashSet--tf2982099.html#a8329377
>> 
>>     Sent from the MyFaces - Users mailing list archive at Nabble.com
>>     <http://Nabble.com>.
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-dataTable%27s-value-be-a-HashSet--tf2982099.html#a8414939
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message