Problem with primefaces, datatable, editMode = "cell"

UI Components for JSF
Post Reply
hbenabed
Posts: 3
Joined: 24 Mar 2015, 17:30

16 Feb 2017, 12:08

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

Code: Select all

 
       <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>

hbenabed
Posts: 3
Joined: 24 Mar 2015, 17:30

21 Feb 2017, 11:37

Hi,
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>...)

albatros
Posts: 27
Joined: 01 Apr 2011, 23:17

02 Oct 2019, 15:47


Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests