Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

primefaces ajax update of panel from another form [duplicate]

I have some code here:

<f:view>
    <h:form id="formA">
        <p:treeTable id="tree">
            <p:ajax event="select" listener="..." update="mustRefresh" />  
            ...
        </p:treeTable>
    </h:form>
    <h:form id="formB">
        <p:panel id="mustRefresh"> ... </p:panel>

    </h:form>   
</f:view>

When user select a record on treeTable(formA), its detail will show on formB and ready to edit. My trouble is update="mustRefresh" not work, it throw exception like this:

javax.faces.FacesException: Cannot find component with identifier "mustRefresh" referenced from "A4578:formA:tree". 

I tried with @form, formB, :formB and :mustRefresh but it does not work.

like image 529
user1487380 Avatar asked Jan 09 '13 03:01

user1487380


2 Answers

Since mustRefresh in the component hierarchy is inside formB you should reference it with:

<p:ajax event="select" listener="..." update=":formB:mustRefresh" />

See how UIComponentBase.findComponent works.

like image 66
Akos K Avatar answered Oct 23 '22 21:10

Akos K


Use update="@([id$=mustRefresh])" -- this will pick up displayPost directly. There is no need to map it to anything.

like image 41
Mahendra Avatar answered Oct 23 '22 20:10

Mahendra