How to bind <rich:dataTable> to backing bean?
Solution 1
The HtmlDataTable
is for <h:dataTable>
, not <rich:dataTable>
.
I'm not sure what component class <rich:dataTable>
is using, but to findout that, you need to replace HtmlDataTable
by Object
and then in the setter print/debug the dataTable.getClass()
so that you can learn which one it is.
By the way, what do you need the binding for? To get the selected row? You could also use DataModel<E>
as datatable value instead. For an example check the following answers:
- How to get the value of an input component in the same datatable row as the button?
- Recommended JSF 2.0 CRUD frameworks
Solution 2
For Richfaces 3.3:
org.richfaces.component.html.HtmlDataTable
For Richfaces 4
org.richfaces.component.UIDataTable
Comments
-
gaffcz almost 2 years
Is there any way to bind rich:dataTable to the bean? I can show the items in non binding rich:dataTable, but when I add binding attribute, whole dataTable dissappear.
Part of code:
<rich:dataTable id="tableDetail" value="#{myBdeCheck.dataListBde}" binding="#{myBdeCheck.dataTable}" var="bdeItem"> <rich:column> <f:facet name="header"> <h:outputText value="Select" /> </f:facet> <h:selectBooleanCheckbox value="#{myBdeCheck.selectedRow}"/> </rich:column> <rich:column> <f:facet name="header"> <h:outputText value="Shift" /> </f:facet> <h:outputText value="#{bdeItem.dayShift}"/> </rich:column> <f:facet name="footer"> <h:commandButton id="btnAdd" action="#{myBdeCheck.add}"/> </f:facet> </rich:dataTable>
For JSF is working
private HtmlDataTable dataTable;
.Is there something else for richfaces? Thank you