1

I have this autocomplete component below that works outside the datatable but it doesn't work inside it

I don't see the cause :

  <p:dataTable id="table" var="car" editable="true" editMode="cell"
                            widgetVar="carsTable" rowKey="#{car.idarticleFourniseur}"
                            value="#{articlesMB.listarticlefournisseurs}" rows="3">

                            <p:ajax event="cellEdit" listener="#{articlesMB.onCellEdit}"
                                update=":messages" />

                            <p:column headerText="Id">
                                <h:outputText value="#{car.idarticleFourniseur}" />
                            </p:column>

                            <p:column headerText="Nom">
                                <h:outputText value="#{car.libelle}" />
                            </p:column>

                            <p:column headerText="Fournisseur">
                                <p:cellEditor>
                                    <f:facet name="output">
                                        <h:outputText value="#{car.fournisseur.personne.nom}" />
                                    </f:facet>
                                    <f:facet name="input">
                                        <p:autoComplete id="dfdd" var="p" itemLabel="#{p.personne.nom}"
                                            itemValue="#{p}" dropdown="true" process="@this"
                                            value="#{articlesMB.selectedFournisseur}"
                                            forceSelection="true" converter="#{fournisseursConverter}"
                                            completeMethod="#{articlesMB.complete}">
                                            <p:column>  
                                                 #{p.personne.nom} - #{p.personne.prenom}  
                                              </p:column>
                                        </p:autoComplete>

                                    </f:facet>
                                </p:cellEditor>
                            </p:column>

                        </p:dataTable>

                        <p:autoComplete id="dfd" var="p" itemLabel="#{p.personne.nom}"
                            itemValue="#{p}" dropdown="true" process="@this"
                            value="#{articlesMB.selectedFournisseur}" forceSelection="true"
                            converter="#{fournisseursConverter}"
                            completeMethod="#{articlesMB.complete}">
                            <p:column>  
                                                 #{p.personne.nom} - #{p.personne.prenom}  
                                              </p:column>
                        </p:autoComplete>

the second autocomplete works fine, but the first (in datatable) doesn't work (the completion does not appear)

do you have any idea

thank you in advance

simonTifo
  • 307
  • 3
  • 12
  • 29
  • Putting the autocomplete inside a facet looks a bit strange to me. Did you try to remove the facet around it? – Jens Apr 24 '13 at 14:41
  • Also: Maybe this [answer](http://stackoverflow.com/a/9731130/332248) from BalusC helps. Put everything in the faces in a panel – Jens Apr 24 '13 at 14:48
  • unfortunetly, the `h:panelgroup` doesn nothing and whe I removed the facet I see this error : `java.lang.NullPointerException at org.primefaces.component.celleditor.CellEditorRenderer.encodeEnd(CellEditorRenderer.java:43)` – simonTifo Apr 24 '13 at 15:01
  • NB : the method of completion is invoked but the list of elements doesn't appear – simonTifo Apr 24 '13 at 15:03
  • Is that a question? :) No, I don't. I would need an example to reproduce this. Then I/one could try to debug this and see where it hangs. If the completion method is invoked I guess the request is also returned to the browser. Did you check with a browser developer tools (e.g. firebug) what the request returns? Maybe the request is returned correctly but there is a visibility problem in the DOM when the auto-complete box should be shown. – Jens Apr 25 '13 at 14:17

1 Answers1

0

Instead of celleditor you can use inplace

<p:inplace editor="true" label="#{contactRole.userDto.fullContactData}" emptyLabel="#{msgs['constructionSite.text.contact']}">
                                    <p:autoComplete value="#{contactRole.userDto}" 
                                        id="contact1" completeMethod="#{assignContactBean.completeContacts}"  
                                        var="c" itemLabel="#{c.fullContactData}" itemValue="#{c}"
                                        converter="#{assignContactBean}" forceSelection="true" scrollHeight="200"/>
                            </p:inplace>
Tamer Awad
  • 392
  • 7
  • 10