Primefaces RowEditor不会更改Datatable中的值

时间:2013-07-24 09:18:36

标签: jsf jsf-2 primefaces

我正在使用带有roweditor的数据表,我的代码与primefaces网站上的展示示例上的代码差不多,但由于某种原因,值不会更新。

当我点击铅笔进行编辑时,当前值不会显示在编辑单元格中。

这是我的代码:

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;
    }
}

结果:

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 个答案:

答案 0 :(得分:1)

您在代码中输入了拼写错误,将{#column.value}更改为#{column.value}