Problem with datatable primeface: lag when editing [closed]

1

I have a datatable that has one of its columns editable. My problem is that when I write in one of the boxes of that column, one of these situations happens to me.

1. It does not focus on the first attempt: I click on the box but the courses do not stay and as it is rejected. I have to click on the other side of the table and return to the box. Even in extreme cases I have to use the f5.

2. The entered data is deleted: When I am entering a quantity and I give it to enter (or click to another side) to finish the action and continue with the next row, the data that I just wrote is deleted. And I have to repeat the action or do f5.

3. It does not allow me to add more rows: This is no longer something of the problem of the box but it belongs to the same view of the datatable in question. This datatable has a button to add more details. The button takes me to another dialog with its datatable from which I select the details to add. But it happens that sometimes when adding a new detail, the datatable where it would have to be added is completely cleaned. And touch f5. This happens after doing a couple of tests.

4. When removing a detail: this is very similar to point 3. With a little use when doing the tests, it cleans all the datatable when wanting to remove one of the rows. In the first attempts everything works fine but then they behave like this.

In none of the cases is shown in error in the application. That's why I have nowhere to see what happens. Please I need a little light at least to know where to look or how to make a better query. I leave the code of sight just in case.

    <h:form  id="formNuevaNotaDespacho">
      <p:messages id="msgs" />
      <p:dialog id="dlgNuevaNotaDespacho" widgetVar="dialogNuevaNotaDespacho" 
                focus="#{notaDespachoBean.nameFocus}" resizable="false"  
                modal="true" width="1270" height="410" 
                header="Registro de Nota de despacho" styleClass=".ui-dialog-title-dialog{ margin:0px;}">
        <p:panelGrid  id="gridNotaDespachoCab">
          <p:row>
            <p:column>
              <p:outputLabel for="numND" value="N° Despacho:" style="display:block; width:70px;"/>
            </p:column>                
            <p:column>
              <p:inputText id="numND" value="#{notaDespachoBean.notaDespacho.numVale}" 
                           style="width:70px; font-weight:bold;" disabled="#{notaDespachoBean.enabledND}"/>
            </p:column>

            <p:column>
              <p:outputLabel for="fecha" value="Fecha:"/>
            </p:column>
            <p:column>
              <p:calendar id="fecha" value="#{notaDespachoBean.notaDespacho.fecVale}"  
                          pattern="dd/MM/yyyy" size="7"/>
            </p:column>

            <p:column>
            </p:column>

            <p:column>
              <p:outputLabel value="Vendedor:"/>
            </p:column>
            <p:column>
              <p:inputText value="#{notaDespachoBean.notaDespacho.agmaeVendedor.nomVendedor}" 
                           style="width:240px" disabled="true"/>        
            </p:column>
            <p:column>
              <p:commandButton  style="width:30px; height: 17px; " icon="ui-icon-search"  
                                oncomplete="PF('dialogConsultarVendedor').show();" />
            </p:column>

            <p:column>
              <p:outputLabel value="Prioridad:"  />        
            </p:column>
            <p:column>
              <p:selectOneMenu value="#{notaDespachoBean.notaDespacho.codPrioridad}" style="width:50px;"  >
                <f:selectItem itemLabel="NORMAL" itemValue="1" />
                <f:selectItem itemLabel="BAJA" itemValue="2" />
                <f:selectItem itemLabel="ALTA" itemValue="3" />
              </p:selectOneMenu>
            </p:column>

            <p:column>
              <p:outputLabel for="estado" value="Estado:"  />
            </p:column>
            <p:column>
              <p:selectOneMenu id="estado" value="#{notaDespachoBean.notaDespacho.flgEstado}" style="width: 70px;"  >
                <f:selectItems value="#{notaDespachoBean.listaEstadoTipoDocumento}" 
                               var="es" itemLabel="#{es.desEstado}" 
                               itemValue="#{es.codEstado}" />
              </p:selectOneMenu>
            </p:column>
          </p:row>

          <p:row>
            <p:column>
              <p:outputLabel value="Cliente:" style="display:block; width:60px;"/>        
            </p:column>
            <p:column colspan="3">
              <p:inputText id="txtCliente" 
                           value="#{notaDespachoBean.notaDespacho.agmaePersona.numIdentificacion}-#{notaDespachoBean.notaDespacho.agmaePersona.nomRazonSocial}" 
                           style="width:270px" disabled="true" />
            </p:column>
            <p:column>
              <p:commandButton style="width:30px; height: 17px; " icon="ui-icon-search"  
                               oncomplete="PF('dialogConsultarCliente').show();"/>
            </p:column>

            <p:column>
              <p:outputLabel value="Observacion:"  />        
            </p:column>
            <p:column colspan="6">
              <p:inputText value="#{notaDespachoBean.notaDespacho.desObservacion}" style="width:100%"/>
            </p:column>
          </p:row>
        </p:panelGrid>

        <p:remoteCommand name="onCellEdit" update=":formNuevaNotaDespacho:tablaNotaDespachoDetalle" />

        <p:dataTable id="tablaNotaDespachoDetalle"
                     var="ndd" value="#{notaDespachoBean.listaNotaDespachoDetalle}"
                     selectionMode="single"
                     selection="#{notaDespachoBean.notaDespachoDetalle}"
                     rowKey="#{ndd.idMovValeProducto}"
                     rowIndexVar="rowIndex"
                     emptyMessage="No hay datos de detalle" scrollable="true" scrollHeight="220"
                     editable="true" editMode="cell"
                     rowStyleClass="#{ndd.numCantidadPresentacion le 1 ? 'alert' : null}">

          <f:facet name="header">
            <p:commandButton   process="formNuevaNotaDespacho" icon="ui-icon-plus" 
                               value="Agregar Producto"
                               actionListener="#{notaDespachoBean.prepararAgregarProducto}"
                               update=":formAgregarProducto :formNuevaNotaDespacho:msgs" />
          </f:facet>

          <p:ajax  event="cellEdit" listener="#{notaDespachoBean.onCellEdit(rowIndex, ndd)}" onstart="onCellEdit()" update=":formNuevaNotaDespacho:msgs"/>

          <p:column headerText="No" width="15" >
            <h:outputText value="#{rowIndex+1}"/>
          </p:column>

          <p:column headerText="Ruc Compañia" width="70" style="align-content:center;">
            <h:outputText value="#{ndd.rucCompanyia}" />
          </p:column>
          <p:column headerText="Nombre de Compañia" width="160">
            <h:outputText value="#{ndd.nomCompanya.toUpperCase()}" />
          </p:column>
          <p:column headerText="Codigo producto" width="60">
            <h:outputText value="#{ndd.codProducto}"/>
          </p:column>
          <p:column headerText="Nombre del producto" width="200">
            <h:outputText value="#{ndd.nomProducto}"/>
          </p:column>
          <p:column headerText="Presentacion" width="60">
            <p:cellEditor>
              <f:facet name="output">
                <p:outputLabel value="#{ndd.nomPresentacion}" />
              </f:facet>
              <f:facet name="input">
                <h:selectOneMenu value="#{ndd.nomPresentacion}" style="width:100%">
                  <f:selectItem itemLabel="UNIDAD" itemValue="UNIDAD" />
                </h:selectOneMenu>
              </f:facet>
            </p:cellEditor>
          </p:column>
          <p:column headerText="Cantidad Presentacion" width="50">
            <p:cellEditor>
              <f:facet name="output">
                <h:outputText value="#{ndd.numCantidadPresentacion}"/>
              </f:facet>
              <f:facet name="input">
                <h:inputText id="txtcantpre" value="#{ndd.numCantidadPresentacion}" style="width:96%;" />
              </f:facet>
              <p:message for="txtcantpre" display="icon" />
            </p:cellEditor>
          </p:column>
          <p:column headerText="Unidad Medida" width="50">
            <p:outputLabel value="#{ndd.nomMedida}" />
          </p:column>

          <p:column headerText="Cantidad" width="40">
            <p:cellEditor>
              <f:facet name="output"><h:outputText value="#{ndd.ctdMovimiento}" /></f:facet>
              <f:facet name="input"><h:inputText id="modelInput" value="#{ndd.ctdMovimiento}" style="width:96%"/></f:facet>
            </p:cellEditor>

          </p:column>
          <p:column headerText="Stock Fecha" width="40">
            <p:outputLabel value="#{ndd.stockFecha}" />
          </p:column>
          <p:column headerText="Stock Actual" width="40">
            <p:outputLabel value="#{ndd.stockActual}" />
          </p:column>

          <p:column headerText="Opciones" width="40" style="text-align:center;" >
            <p:commandButton id="delButton" icon="ui-icon-trash" title="Eliminar" style="width:17px; height: 17px;"                                  
                             actionListener="#{notaDespachoBean.quitarNotaDespachodetalle(ndd, rowIndex)}" 
                             update=":formNuevaNotaDespacho:tablaNotaDespachoDetalle :formNuevaNotaDespacho:gridNotaDespachoCab"/>
          </p:column>
        </p:dataTable>    

        <center>
          <p:commandButton value="#{notaDespachoBean.nameBtnSave}" 
                           actionListener="#{notaDespachoBean.guardarNotaDespacho()}"
                           update=":formNotaDespachos:tablaNotaDespachos :formNotaDespachos:msgs :formNuevaNotaDespacho:msgs" />
          <p:spacer width="30"/>
          <p:commandButton value="Cancelar" oncomplete="PF('dialogNuevaNotaDespacho').hide();" />    
        </center>
      </p:dialog>
    </h:form>
    
asked by Hector Ccasani PerdidaMente 27.03.2018 в 21:42
source

0 answers