0
votes

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
1
{#column.value} should be #{column.value}. Is this just a typo or does your actual code contain it?user1983983
My actual code contains it, thanks for pointing it out. It's now working. I can't believe it was a mistake that stupid. How do I set your answer as accepted?noisegrrrl

1 Answers

1
votes

You have a typo in the code, change {#column.value} to #{column.value}.