primefaces ajax update of panel from another form [duplicate]

柔情痞子 提交于 2019-12-09 12:09:39

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/14227681/primefaces-ajax-update-of-panel-from-another-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!