-
1. Re: How to selectively display rows in rich:dataTable
ufonaut Sep 9, 2010 3:39 AM (in response to daxxy)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:
@Name("filterBean")
@Scope(SESSION)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 :
<rich:datatable
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).