java - Cannot find component with expression? -
this question has answer here:
i used datatable - row selection prime faces display list of users , when run page faced error
cannot find component expression ":dialog1:employes" referenced "dialog1:j_idt43:j_idt51"
<h:form id="dialog1"> <p:accordionpanel> <p:tab title="nouveau groupe"> <h:panelgrid columns="2"> <h:outputlabel value="nom groupe" /> <p:inputtext value="#{calculjobsbean.libelle}" /> </h:panelgrid> <p:commandbutton value="submit" action="#{calculjobsbean.ajouter()}" icon="ui-icon-check" style="margin-left: 40%" oncomplete="pf('dialogaddgroupesalriers').hide()" /> </p:tab> <p:tab title="liste salariers"> <h:outputlabel value="matricule:" /> <p:inputtext value="#{donneesindividuellesbean.matricule}" onkeypress="if (event.keycode == 13) {onchange(); return false; }"> <p:ajax event="change" listener="#{donneesindividuellesbean.chercheremployesbymatricule()}" update=":dialog1:employes" /> </p:inputtext> <!-- <p:commandbutton icon="ui-icon-plus fa fa-plus" onclick="pf('dialog1').show()" update=":formdialog1"> </p:commandbutton> --> <p:commandbutton icon="ui-icon-plus fa fa-plus" onclick="pf('dialog2').show()" update=":formdialog1"> </p:commandbutton> <p:panel header="liste des salariers"> <h2>select + add</h2> <p:datatable id="employes" value="#{donneesindividuellesbean.employescherches}" var="emp" selection="#{donneesindividuellesbean.identiteselectionne}" rowkey="#{emp.numedoss}" selectionmode="single"> <f:facet name="header"> </f:facet> <!-- <p:ajax event="rowselect" execute="@this" update=":employe" /> --> <p:column style="width:40px"> <p:graphicimage value="#{donneesindividuellesbean.photoe}" cache="false" id="dragimg" style="width:30px; height:40px;"> <f:param name="empid" value="#{emp.numedoss}" /> <p:draggable for="dragimg" revert="true" helper="clone" /> </p:graphicimage> </p:column> <p:column headertext="matricule"> <h:outputtext value="#{emp.matricul}" /> </p:column> <p:column headertext="nom"> <h:outputtext value="#{emp.nom}" /> </p:column> <p:column headertext="prenom"> <h:outputtext value="#{emp.prenom}" /> </p:column> </p:datatable> </p:accordionpanel> </h:form> </p:dialog>
what problem code ?
some of components within jsf/primefaces implement namingcontainer
inerface. such components affect way client ids of children generated. examples of such components include <h:form>
(htmlform
class) , <p:accordionpanel>
(accordionpanel
class). while seem aware of former, did not know latter naming container well.
when want ajax-update given component need specify either id, in case it's located relative same naming container, or client id, in case it's relative view root. tying view structure update=":formid:accordionpanelid:datatableid".
the last issue concern every component must have id set found within component tree , surely unique. in case supply id of own, in id="mycomponentid"
, you set id component. otherwise component id autogenerated jsf framework you: that's why ind j_idt43
ids.
to sum up, need explicitly specify id accordion panel , include in path to-be-updated component (exactly proposed in wittakarn's answer).
Comments
Post a Comment