簡體   English   中英

Primefaces Ajax無法在字段數據表上更新

[英]Primefaces ajax not working update on field datatable

我的應用程序中的“”組件有問題。 我有一個數據表,其中2個字段可編輯,第一個是inputtext,第二個字段是dateInput。

在字段內部,我將更新列表中的值,但是將其提交給bean時不會更新值。

下面是我的page.xhtml和bean。

<p:dialog id="modalNovosParametrosRecesso" header="Salvar Novos Parâmetros de Estagiário"
                  widgetVar="widgetvarNovoParametro" 
                  draggable="true" resizable="false" 
                  closable="false" modal="true" width="630">

               <h:outputText styleClass="modalRecessoAuto" value="#{msg.MN064}" escape="false" />

              <br />   
             <h:panelGroup>
                <br />
                <p:dataTable id="tableRegRecessoAuto" var="recessoAuto"
                    value="#{parametroEstagiarioMB.visao.listaOcorrenciaRegistroRecesso}"
                    styleClass="hide-column-names" rowIndexVar="rowIndex" >

                    <p:column style="width:98px;">
                        <h:outputLabel value="#{rowIndex+1}º Recesso de " style="color: #0039BA" />
                        <p:inputText value="#{recessoAuto.diasRecesso}" size="2">
                            <p:ajax event="blur" update=":frmFiltro:tableRegRecessoAuto" ignoreAutoUpdate="true"    global="false" />
                        </p:inputText>

                        <h:outputLabel value="dia(s) começando em " style="color: #0039BA" />
                        <p:inputMask value="#{recessoAuto.dtInicioOcorrencia}"  mask="99/99/9999" size="10">
                            <f:convertDateTime pattern="dd/MM/yyyy" locale="pt_BR" />
                            <p:ajax event="blur" update=":frmFiltro:tableRegRecessoAuto" ignoreAutoUpdate="true"    global="false"/>                                
                        </p:inputMask>

                        <h:outputLabel value=" e finalizando em " style="color: #0039BA; margin-left: 5px;"/>
                        <h:outputLabel id="dtLbl1" value="#{recessoAuto.dtFimOcorrencia}"   style="color: #0039BA; margin-left: 5px;" >
                           <f:convertDateTime for="dtLbl1" pattern="dd/MM/yyyy" locale="pt_BR"/>
                        </h:outputLabel>
                    </p:column>

->

            <div style="padding-left: 170px;">



                <p:commandLink styleClass="btnLaranja marginTop"
                               ignoreAutoUpdate="true" global="false" ajax="false" action="#{parametroEstagiarioMB.salvarRecessoPrimeiraParametrizacao()}"
                               update=":frmFiltro:tableRegRecessoAuto">
                    <span>Confirmar</span>
                </p:commandLink>                    

                <p:commandLink styleClass="btnLaranja marginTop"
                                id="btnCancelarRecessoAuto"
                                oncomplete="PF('widgetvarNovoParametro').hide();"
                                ignoreAutoUpdate="true" global="false" actionListener="#{parametroEstagiarioMB.cancelar}">
                                <f:setPropertyActionListener
                                    target="#{parametroEstagiarioMB.visao.exibirModal}"
                                    value="#{false}" />                                 
                                <span>Cancelar</span>
                </p:commandLink>

                <p:commandLink styleClass="btnLaranja marginTop"
                               id="btnVerRegrasAuto"
                               oncomplete="PF('widgetvarModalRegras').show();"
                               ignoreAutoUpdate="true" global="false">
                               <span>Regras</span>
                </p:commandLink>
            </div>  

        </p:dialog>

我的豆子:

public void salvarRecessoPrimeiraParametrizacao(){

    int count = 0;      

    final DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot()
            .findComponent(":frmFiltro:tableRegRecessoAuto");

    List<OcorrenciaPonto> teste = new ArrayList<OcorrenciaPonto>();

    for(OcorrenciaPonto c : (List<OcorrenciaPonto>) dataTable.getValue()){
        teste.add(c);
        count+=1;
    }}

datatable.getValues()不獲取新值,而是獲取屏幕上顯示的舊值。

您是否正確使用了getter和setter?

您是否嘗試過在輸入字段上使用immediate="true"

我看到您正在使用<p:ajax>
我對此有些麻煩。
也許,如果您更改為**<f:ajax>**它必須運行良好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM