How to access the parent Naming Container of Composite?

不打扰是莪最后的温柔 提交于 2019-11-30 21:13:47

I have a workaround for this Problem. If you can not find another solution, you can use it as an alternative. The Solution is a mix between jsf and javascript. For your table you define a widget (e.g. "myTable").

<p:dataTable id="dataTable" var="userItem" ...  widgetVar="myTable"/>

It is a global javascript variable named "myTable" is created. this widget object contains an id. For you command button (h:commandButton not p:commandButton) you define onklick event:

<h:commandButton id="deleteItem" action="#{userController.doDelete(userItem.id)}"
 value="delete" onclick="PrimeFaces.ab({formId:$(this).closest('form').attr('id'),source:this.id,process:'@all',update:myTable.id});return false;" /> 


formId - you enter the form ID explicitly or use my Jquery function
update - myTable.id is a Table ID (exactly div wrapper)
process - @all, @this, @form etc..

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