rich:columns, rich:column visible attribute : show/hide colu
apg9595 Aug 10, 2009 1:27 PMI have searched through google for more elaborate way of using this particular attribute to show/hide columns in a dynamic manner
Richfaces 3.3.2
Jboss 4.3 EAP
Linux/Windows/Solaris
Myfaces 1.2.5
Here is my code
<rich:scrollableDataTable
frozenColCount="# {itemController.grid.frozenColCount}"
height="500px"
width="1200px"
id="grid"
rows="40"
value="#{itemController.grid.rows}" var="row"
rowKeyVar="rowKey"
hideWhenScrolling="true"
rowClasses="row1,row2"
>
<rich:columns value="#{itemController.grid.columns}"
var="column"
index="ind" id="dynaColumn"
sortable="false"
visible="#{column.visible}"
>
<f:facet name="header" >
<h:outputText value="#{column.name}"
styleClass="richDataTableHeaderFont"/>
</f:facet>
<a4j:commandLink id="expandCollapse" value="#{row.cells[ind].ref.expandable ? !row.cells[ind].ref.expanded?'[ + ]':' [ - ]': ''}" rendered="#{ind==0}" onclick="expandCollapseColumn(#{rowKey},#{ind})"/>
</rich:columns>
</rich:scrollableDataTable>
Here is my demo class structure
public class Grid {
public class Column {
private String name;
private String value;
private boolean visible;
//getter setters for all the variables
}
}
When i add the visible attribute i get this exception. I can't seem to find out what is wrong. I can use the "rendered " attribute to show/hide columns but more appropriate would be the visible attribute.
org.apache.jasper.JasperException: /datatable.jsp(69,3) Unable to find setter method for attribute: visible
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2736)
org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:2965)
org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomStart(Generator.java:2169)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1689)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)