行编辑事件未更新新值

时间:2017-04-10 06:11:09

标签: jsf primefaces pf-datatable

我使用Primefaces已经苦苦挣扎了几天,DataTable在编辑一行后没有显示新值。

我搜索了很多但无法得到解决方案。

所以任何人都可以帮助我...谢谢

Html代码

<h:form id="form">
            <div id="nav">
                <ui:insert name="commonHeader">
                    <ui:include src="templates/commonHeader.xhtml" />
                </ui:insert>
            </div><br/><br/>

            <div class="container" style="margin-top: 50px;">
            <p:commandButton value="Add New Project" action="AddProject.xhtml?faces-redirect=true"></p:commandButton>
            <br/>
            <br/>
            <p:dataTable id="db" var="rows" rowKey="#{rows.id}" editable="true"
                value="#{projectBean.list}">
                <f:facet name="header">
                    <h:outputLabel value="Project Details"></h:outputLabel>
                </f:facet>
                <p:ajax event="rowEdit" listener="#{projectBean.onRowEdit}"
                        update=":form:db" />
                <p:ajax event="rowEditCancel"
                        listener="#{projectBean.onRowCancel}" update=":form:db" />
                <p:column headerText="ID" style="width:32px">
                    <p:outputLabel value="#{rows.id}"></p:outputLabel>
                </p:column>
                <p:column headerText="Project Title" filterBy="#{rows.title}" filterMatchMode="contains">
                    <p:cellEditor>
                        <f:facet name="output">
                        <p:commandLink action="#{projectBean.openProjects(rows)}"
                                    process="@this" immediate="true">
                                    <p:outputLabel value="#{rows.title}"></p:outputLabel>
                        </p:commandLink>

                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{rows.title}" style="width:100%"
                                    required="true" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                <p:column headerText="Project Description" filterBy="#{rows.description}" filterMatchMode="contains">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{rows.description}" />
                        </f:facet>
                        <f:facet name="input">
                            <p:inputText value="#{rows.description}" style="width:100%"
                                required="true" valueChangeListener="projectBean.newd" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                <p:column headerText="Insertion TimeStamp">
                    <p:outputLabel value="#{rows.insertionTimestamp}"></p:outputLabel>
                </p:column>
                <p:column headerText="Close TimeStamp">
                    <p:outputLabel value="#{rows.closeTimestamp}"></p:outputLabel>
                </p:column>
                <p:column style="width:64px">
                    <p:rowEditor />
                </p:column>
                <p:column style="width:100px;text-align: center;" >
                <p:commandLink value="Delete">
                    <p:ajax update="db" listener="#{projectBean.deleteProj(rows)}"></p:ajax>
                </p:commandLink>
            </p:column>
            </p:dataTable>
            </div>
        </h:form>

但是当调用rowEdit事件时,我无法在函数onRowEdit(RowEditEvent事件)中获取新值

Bean函数如下所示

public void onRowEdit(RowEditEvent event) {
        try {
            stub = new BusinessServiceStub();
            UpdateProjectRecord PARAM = new UpdateProjectRecord();
            PARAM.setArg0((Project) event.getObject());
            UpdateProjectRecordE reques = new UpdateProjectRecordE();
            reques.setUpdateProjectRecord(PARAM);
            UpdateProjectRecordResponseE response = stub
                    .updateProjectRecord(reques);
            UpdateProjectRecordResponse responseRecive = response
                    .getUpdateProjectRecordResponse();
            int result = (responseRecive.get_return());
            if(result>0){

            }
        } catch (Exception e) {
            System.out.println(e.toString());
        }
    }

0 个答案:

没有答案