Issue Details (XML | Word | Printable)

Key: JAVASERVERFACES_SPEC_PUBLIC-1103
Type: New Feature New Feature
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Ed Burns
Votes: 12
Watchers: 9
Operations

If you were logged in you would be able to see more operations.
javaserverfaces-spec-public

UIRepeat supports Collection

Created: 23/May/12 06:32 PM   Updated: 08/Nov/13 09:15 PM
Component/s: Components/Renderers
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Issue Links:
Duplicate
 

Tags:
Participants: Aditya , Ed Burns, Ertio lew and kithouna


 Description  « Hide

I encountered a problem attempting to set the ui:repeat "value" attribute to an
instance that was a subclass of java.util.Set (specifically Hibernate's
PersistentSet class): the UIRepeat class treated it like a scalar object.

An iteration tag like ui:repeat should work with all Collection types in my
opinion. In the UIRepeat.getDataModel() method it's possible to detect an
instance of Collection and make use of the ArrayDataModel by invoking the
toArray() method on the instance. In this way a new DataModel implementation
isn't needed. I've made this change in my own copy of Facelets and it works
beautifully.

Hibernate happens to use Sets quite a bit, so this was important to me. I'd be
happy to submit a patch.

This issue occurs in Facelets 1.2 as well.\



Aditya added a comment - 10/Sep/12 06:04 AM

Not only just collections, ui:repeat should also support iterables as well for the value attribute.


Ertio lew added a comment - 11/Mar/13 05:09 PM

ui:repeat should allow iterables to be used with them. Currently we are required to create a new list from iterable just to support ui:repeat. This limitation should be removed.


kithouna added a comment - 27/Sep/13 02:10 PM

The collection / iterable to datamodel conversion should be abstracted and put in a global place. Now DataTable and UIRepeat do pretty much the same thing and differences crop up between them that benefit no one.

Then, we the users should be able to register additional datamodel converters, so we can register something like OmniFaces' IterableDataModel and they would be automatically used by DataTable, UIRepeat and others.