Reputation: 159
I'm using a datatable with a roweditor, my code is more or less the same as the code on the showcase example on the primefaces website but for some reason, the values are not updated.
Also when I click on the pencil to edit, the current value is not showing up in the editing cell.
Here's my code:
xhtml:
<h:form id="updateform">
<p:dataTable id="updatetable" value="#{EditingBean.row}" var="column"
editable="true"
style="width: 780px; overflow-x: auto; white-space: normal;">
<f:facet name="header">TEST</f:facet>
<p:column rendered="#{column.display}" style="white-space: normal;">
<h:outputText value="#{column.alias}" />
</p:column>
<p:column rendered="#{column.display}" style="white-space: normal;">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{column.value}" />
</f:facet>
<f:facet name="input">
<p:inputText value="{#column.value}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column rendered="#{column.display}" style="white-space: normal;">
<p:rowEditor rendered="#{column.modify}" />
</p:column>
</p:dataTable>
</h:form>
EditingBean:
@ManagedBean(name = "EditingBean")
@ViewScoped
public class EditingBean implements Serializable {
private static final long serialVersionUID = -772702647887310138L;
private List<Result> row;
public List<Result> getRow() {
return row;
}
public void setRow(List<Result> row) {
this.row = row;
}
}
Result:
public class Result implements Serializable {
private static final long serialVersionUID = 1L;
private String alias;
private String name;
private String value;
private String modify;
private String display;
// getters + setters
Upvotes: 0
Views: 1412
Reputation: 4841
You have a typo in the code, change {#column.value}
to #{column.value}
.
Upvotes: 1