2 Replies Latest reply on Jul 22, 2009 5:53 PM by clerum

    Wrapping a List in a DataModel

    clerum

      Assuming I have a entity called organization and a entity called user. Organzation has a List <User> users variable with a OneToMany relationship.


      Is it possible to access the list #{organization.users} for use in a rich:datatable  and also have it work with the @DataModelSelection without outjecting it via an @DataModel annotation?


      Basically I'm asking if I can wrap the List/Collection into a DataModel from the JSF page.


      If this isn't possible currently, is it something that is planned for JSF2.0/seam 3.0?

        • 1. Re: Wrapping a List in a DataModel
          asookazian

          Why don't you write a getter method in your backing bean that return ListDataModel?


          I don't think it's currently possible to do what you're asking (wrapping in the presentation layer) and most likely this will not be added to any spec b/c it is not a popular/frequent use case...

          • 2. Re: Wrapping a List in a DataModel
            clerum

            I would think his is a fairly common use case. It's only natural to want to use the Collections provided by JPA/Hibernate directly in the Presentation layer...just like any of the other variables.


            Anyone else run into this?