rich:dataGrid cell help
daleellis1983 Aug 10, 2011 9:44 AMHi all,
I'm new to Richfaces, I have developed in JSF1.1 for a few years and worked with ADF for about 2 months but that's about as much similar experiance I have with Richfaces.
I have always liked the look of richfaces so a project at work I have decided to use it as it fits the bill. I require to have a small config driven site and I am having an issue with dataGrid.
In many places I am trying to loop through some configuration data which are usually name value pairs but all elements are inserted into the one cell per iteration.
If I use panelGrid it behaves almost fine I have to use a loop and load the dataGrid stylesheet to make it appear the same as a dataGrid and that is ok in most scenrios. The one scenrio that doesn't work is if I have items that are not rendered such as below, that cause some blank cells.
<h:panelGrid styleClass="rf-dg" rowClasses="rf-dg-r" columnClasses="rf-dg-c, rf-dg-c, rf-dg-c, rf-dg-c, rf-dg-c, rf-dg-c, rf-dg-c, rf-dg-c"
style="width:${layoutBean.caseSearchBoxWidth}" columns="${layoutBean.caseSearchBoxColumns}">
<c:forEach items="${caseBean.searchFields}" var="field">
<h:outputLabel value="${field.definition.label}" style="font-weight: bold;"/>
<!-- Display different types of field depending on type -->
<!-- NORMAL TEXT BOX -->
<h:inputText value="${field.value}" label="${field.definition.label}" rendered="${empty field.definition.options}" />
<!-- SELECT LIST -->
<h:selectOneMenu value="${field.value}" label="${field.definition.label}" rendered="${not empty field.definition.options}">
<f:selectItems value="${field.definition.options}" />
</h:selectOneMenu>
</c:forEach>
</h:panelGrid>
<rich:dataGrid value="${caseBean.searchFields}" var="field"
style="width:${layoutBean.caseSearchBoxWidth}" columns="${layoutBean.caseSearchBoxColumns}">
<h:outputLabel value="${field.definition.label}" />
// Display different types of field depending on type
//NORMAL TEXT BOX
<h:inputText value="${field.value}" label="${field.definition.label}" rendered="${empty field.definition.options}" />
// SELECT LIST
<h:selectOneMenu value="${field.value}" label="${field.definition.label}" rendered="${not empty field.definition.options}">
<f:selectItems value="${field.definition.options}" />
</h:selectOneMenu>
</rich:dataGrid>
So what I woudl really like is to use the dataGrid tag as above in teh 2nd example but have it put each individual item in a cell like a panelGrid does. I have tried wraping the various output tags to try make it move onto a new cell such as wraping outputText tags with columns tags or panel tags but no success as yet.
Is there a way to achieve what I'm after? Am I using the right tag? maybe I have misunderstand teh purpose of dataGrid
Thanks in advance,
Dale