1 Reply Latest reply on Sep 9, 2010 3:39 AM by Rob Acraman

    How to selectively display rows in rich:dataTable

    Tanya Ruttenberg Expert

      I have a set of data that I want to display in a dataTable EXCEPT for the rows where type='NAM'.


      Is there some way to do this with rich:dataTable?


      If not I can alter my query, but I'd prefer to do it in richfaces if possible.


      Version 3.3.X.




        • 1. Re: How to selectively display rows in rich:dataTable
          Rob Acraman Newbie

          I don't think it does (But I'd be delighted to be shown something I've been missing all this time !)


          The other thing is that it's not always possible - let alone wise - to limit your queries.  We're using JPA, and sometimes we want our tables to show the "child" collection of a master record.  Unfortunately, with JPAQL, there's no way to filter the query of child collections (since JPAQL doesn't have WITH, so we can't have "LEFT JOIN m.child WITH ...").  Oh, the amount of horrid workarounds I've seen, with people trying to maintain their own lists.


          The simplest solution, I reckon, is to have a stateless utility bean, and put your filtering in there - eg. with Seam:



          public class FilterBean {

          public static List<T> notNam( Collection<T> collection ) {

            List<T> result = new ArrayList<T>();

            // filter away .....

            return result;



          Your xhtml is then :


             value = "#{ filterBean.notNam ( yourBean.yourCollection ) }"



          You can then let the users add or remove to the collection, and still let Hibernate or whatever look after the merging (since the collection is still the full collection retrieved from the database).