6 Replies Latest reply on May 26, 2006 3:20 PM by Gavin King

    Conceptual problem: Reusable lists?

    eekboom Newbie

      Basically I started by adopting the "clickable lists" (messages) example, just for me it was a list of Employee entities.

      Ok, now by user demand I added some filter options: internal/external, current/retired/future, specific branch or all branches.
      This was easy to do: I added some variables to the EmployeeManagerBean (the one that also holds the DataModel). The accessors of those variables are referenced by JSF selectOneBoolean/selectOneChoice components.
      The Factory method uses these variables to query for only a subset of all employees. Whenever a setter of any of this filter variables is called, I set the DataModel variable to null, so that seam calls the factory method again as needed.

      Now on to the trouble: I want this same kind of list on three or four pages in my application, but each list should have its own filter values.
      How do I reuse my list?

      I could define multiple instances of my EmployeeManagerBean, but that would still give me only one DataModel (because the datamodel introduces a seam variable of its own), right?

      Wouldn't it be more powerful and just as easy to use, if the DataModel annotation would define a property of the owning component, rather than a variable of its own?

      Or am I missing something and there's an easier way to do this?