单元格编辑后无法在primeface中工作时更新DataTable

时间:2015-05-22 13:14:54

标签: jsf primefaces datatable jsf-2.2

我有一个数据表包含一些用于编辑的单元格,这些单元格在特定条件下被禁用,并且在启用其他单元格版本之后。 我的问题是编辑后,新数据存储在数据库中,但数据表没有直接更新,重新加载页面后会更新。

我想要的是如何在编辑或重新加载页面后更新孔数据

这是我的代码:

<h:form id="process">
        <p:remoteCommand name="onCellEdit" update=":process:ListC" />
    <p:dataTable id="ListC"
        value="#{recruitmentProcessMB.candidateListInProcess}"          
        var="candid" rowKey="#{candid.idCandidate}"
        style="border:0px; " paginator="true"
        paginatorTemplate="{PreviousPageLink} {NextPageLink} {RowsPerPageDropdown}"
        rowsPerPageTemplate="3,5,10" paginatorPosition="top"
        rows="10" editable="true" editMode="cell">
        <f:facet name="footer" >
            <h:outputLabel value="Valider processus pour le Manager:" style="display: inline-block;"/>

            <h:selectOneMenu id="managersInProcess" style="display: inline-block;"
                             value="#{recruitmentProcessMB.selectedManagerInProcess}">
                <f:selectItem itemLabel="Selectionner..." itemValue="#{null}"/>
                <f:selectItems value="#{recruitmentProcessMB.managersInProcess}" />
            </h:selectOneMenu>
            <h:outputText value="&#160;" />
            <h:outputText value="&#160;" />
            <h:outputText value="&#160;" />
            <h:outputText value="&#160;" />
            <h:outputText value="&#160;" />

            <p:commandButton icon="ui-icon-seek-next" 
                value="Valider le processus"
                ajax="true"
                style="display: inline-block;"
                disabled="false"></p:commandButton>

        </f:facet>

         <p:ajax  event="cellEdit" 
                    update=":process:ListC"
                    immediate="true"
                    listener="#{recruitmentProcessMB.onCellEdit}"
                    process="@this" 
                    oncomplete="onCellEdit()"

                 />

        <p:column headerText="Prenom">
            <h:outputText value="#{candid.firstNameCandidate}" />
        </p:column>
        <p:column headerText="Nom">
            <h:outputText value="#{candid.nameCandidate}" />
        </p:column>
        <p:column headerText="Specialité">
            <h:outputText value="#{candid.specialityCandidate}" />
        </p:column>

        <p:column headerText="Niveau d'etude">
            <h:outputText value="#{candid.levelStudyCandidate}" />
        </p:column>  

        <p:column headerText="CV" style="text-align: center ;width:30px;">
            <p:commandButton icon="ui-icon-arrowthickstop-1-s"
                ajax="false"
                actionListener="#{recruitmentProcessMB.downloadAction(candid.cvCandidate,candidate.nameCandidate,candidate.firstNameCandidate)}">

                <p:fileDownload
                    value="#{recruitmentProcessMB.downloadContentProperty}" />
            </p:commandButton>
        </p:column>

        <p:column headerText="Manager" style="position:center;">
            <h:outputText
                value="#{candid.employee.firstNameEmployee} #{candid.employee.nameEmployee}" />

        </p:column>

        <p:column headerText="Date d'entretien">
            <p:cellEditor id="c1">
                <f:facet name="output">
                    <h:outputText value="#{candid.interviewDateCandidate}">
                        <f:convertDateTime type="date" dateStyle="short"
                            pattern="dd/MM/yyyy" timeZone="Europe/Paris" />
                    </h:outputText>
                </f:facet>
                <f:facet name="input" >
                    <p:calendar id="dateInterview"
                        value="#{candid.interviewDateCandidate}"
                        navigator="true" pattern="dd/MM/yyyy" mask="true" immediate="true" />
                </f:facet>
            </p:cellEditor>

        </p:column>

        <p:column headerText="Validation Par Manager " >
            <p:cellEditor id="c2">
                <f:facet name="output" >
                    <h:outputText
                        value="#{candid.decisionOfManager}" />
                </f:facet>
                <f:facet name="input"  >
                         <h:selectOneMenu id="manegerDecision" style="display: inline-block;"
                                    value="#{candid.decisionOfManager}"
                                    disabled="#{candid.currentTask!='InterviewAndValidationByManager'}" 
                                    immediate="true">
                        <f:selectItem itemLabel="Selectionner..." />
                        <f:selectItem itemLabel="Accepté" itemValue="Accepté"/>
                        <f:selectItem itemLabel="Refusé" itemValue="Refusé"/>

                    </h:selectOneMenu>
                </f:facet>
            </p:cellEditor>

        </p:column>

        <p:column  headerText="Validation Par RH " >
        <p:cellEditor id="c3" >
            <f:facet name="output">
            <h:outputText
                value="#{candid.decisionOfRh}" />
                </f:facet>
            <f:facet name="input">
                 <h:selectOneMenu id="rhDecision" style="display: inline-block;"
                            value="#{candid.decisionOfRh}"
                            disabled="#{candid.currentTask!='InterviewAndValidationByRH'}" 
                            immediate="true">
                <f:selectItem itemLabel="Selectionner..." />
                <f:selectItem itemLabel="Accepté" itemValue="Accepté"/>
                <f:selectItem itemLabel="Refusé" itemValue="Refusé"/>

            </h:selectOneMenu>
            </f:facet>
            </p:cellEditor>

        </p:column>

    </p:dataTable>
    </h:form>

0 个答案:

没有答案