简体   繁体   中英

How to update datatable in tab of accordion (primefaces)

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.

使用以下代码进行更新:

<p:ajax event="close" listener="#{aMB.selectedReset}" update="@([id$=table_a])" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM