0

I have a problem with primefaces, datatable, editMode = "cell"

I have a datatable, editable with editMode = "cell". If I modify a cell and I immediately click on the "validate" button (without leaving the cell), the button does not work and the cell is still in edit mode, and if I click the "validate" button again Button works.

Here you can look to my dataTable :

        <p:dataTable var="fact" id ="FactureTable" 
                value="#{monBean.factureDataModel}"
                            editable="true" rowKey="#{fact.id.factNumero}" 
                            emptyMessage="#{fichierMessage['DATATABLE.NORECORDSFOUNS']}" 
                            scrollable="true" scrollHeight="100" editMode="cell" selection="#{monBean.factureSelectionner}" >

                            <p:ajax event="rowSelectRadio"  process="@this" listener="#{monBean.selectionnerFacture}" update=":#{p:component('InterventionTable')}"/>
                            <p:column selectionMode="single" style="width:10px;">
                            </p:column>

                            <p:column headerText="#{messages['Facture.numero']}" >
                                <p:cellEditor >
                                    <f:facet name="output">
                                        <h:outputText value="#{fact.id.factNumero}" />
                                    </f:facet>
                                    <f:facet name="input">
                                        <p:inputText  value="#{fact.id.factNumero}" disabled="#{fact.griserCode}"
                                            style="width:96%" />
                                    </f:facet>
                                </p:cellEditor>
                            </p:column>

                            <p:column headerText="#{messages['Facture.date']}">
                                <p:cellEditor>
                                    <f:facet name="output">
                                        <h:outputText value="#{fact.factDate}">
                                          <f:convertDateTime type="date" dateStyle="short"
                                            pattern="dd/MM/yyyy" />
                                    </h:outputText>
                                    </f:facet>
                                    <f:facet name="input">
                                        <p:inputMask  maxlength="12" style="width:96px;" value="#{fact.factDate}" mask="99/99/9999"  disabled="#{fact.griserCode}">
                                       <f:convertDateTime type="date"  dateStyle="short" pattern="dd/MM/yyyy" />
                                       <p:ajax process="@this" listener="#{monBean.affectationMoisEtExercice(fact)}" update=":#{p:component('FactureTable')},:#{p:component('message')}"/>
                                    </p:inputMask>
                                    </f:facet>
                                </p:cellEditor>
                            </p:column>
        </p:datatable>
Yagami Light
  • 1,756
  • 4
  • 19
  • 39

1 Answers1

0

I use this solution :

I don't use editMode="cell" in p:dataTable I change editable="true" by editable="false" in p:dataTable

I don't use p:cellEditor f:facet name="output"

simply in p:column I use p:inputText,p:inputMask...,


Pour éviter les problème de l'Ajax dans les "datatable" éditables, merci suivre les instruction suivante :

l'attruibut editMode="cell" ne doit pas figurer dans le tag p:dataTable changer editable="true" par editable="false"

ne pas utiliser les tags : p:cellEditor f:facet name="output"

Un simple tag va être utilisé pour l'affichage et la modification des donnée exple (p:inputText,p:inputMask...)