Reputation: 1682
I have Accordionpanel>Tab>DataTable.If u click/select row in datatable,Showing a dialog.And if u close the dialog,I reset the selected row from managedbean(thats work). But I can't update the above datatable in acc>tab.
code looks like this:
<h:form id="alphabets">
<h4>XYZ</h4>
<p:accordionPanel id="acc" value="#{aMB.aList}"
var="a" multiple="false" dynamic="true">
<p:tab title="#{a.name}">
<p:dataTable id="table_a" var="b"
value="#{a.Blist}" selectionMode="single"
selection="#{aMB.selectedA}" rowKey="#{b.id}"
rowIndexVar="count">
<p:ajax event="rowSelect" update=":dialog_form:table_c"
onstart="PF('cDialog').show()" />
<p:column style="width:40px !important;" headerText="id"
sortBy="#{count}">
<h:outputText value="#{count+1}" />
</p:column>
<p:column headerText="Name:">
<h:outputText value="#{b.name}" />
</p:column>
</p:dataTable>
</p:tab>
</p:accordionPanel>
</h:form>
<h:form id="dialog_form">
<p:dialog header="xyz details" widgetVar="cDialog"
closeOnEscape="true" showEffect="fade" hideEffect="fade"
resizable="false">
<p:ajax event="close" listener="#{aMB.selectedReset}"
update=":alphabets:acc:tab#{acc.activeIndex}" />
<p:dataTable id="table_c" var="c"
value="#{aMB.selectedB.cList}" selectionMode="single"
rowKey="#{c.id}"
rowIndexVar="count">
<p:column style="width:40px !important;" headerText="id"
sortBy="#{count}">
<h:outputText value="#{count+1}" />
</p:column>
<p:column headerText="Name">
<h:outputText value="#{c.name}" />
</p:column>
</p:dataTable>
</p:dialog>
</h:form>
When I try to open this page,I am getting below error:
javax.faces.FacesException: Cannot find component with expression ":alphabets:acc:tab" referenced from "dialog_form:j_id_b".
So I cannot update this table from dialog.Does anyone have any idea or experience?Thanks in advance.
Upvotes: 1
Views: 2994
Reputation: 1352
Update using following code :
<p:ajax event="close" listener="#{aMB.selectedReset}" update="@([id$=table_a])" />
Upvotes: 2