How to reference p: commandLink in p: dataTable from p: blockUI trigger?
This does not work for me:
<h:form id="wfMgtForm"> . . . <p:dataTable id="wfTable" ..." var="item"> <p:column> . . . </p:column> <p:column> <p:commandLink id="editWatchfolderButtonId" oncomplete="dlgEditWF.show()" update=":editWFForm" process="@none"> <f:param value="#{item.value.ID}" name="editId"/> <h:graphicImage alt="Edit Image" style="border: none" value="./images/edit.png" /> </p:commandLink> </p:column> . . . <p:blockUI block=":wfMgtForm" trigger="editWatchfolderButtonId"> Loading...<br/> <p:graphicImage alt="Loader Image" value="/images/loader.gif"/> </p:blockUI> </h:form> The error I get is:
Cannot find component with identifier "editWatchfolderButtonId" .
When I used Firebug to search for an identifier, I found that each line has a different identifier:
wfMgtForm:wfTable:0:editWatchfolderButtonId wfMgtForm:wfTable:1:editWatchfolderButtonId wfMgtForm:wfTable:2:editWatchfolderButtonId wfMgtForm:wfTable:3:editWatchfolderButtonId
and etc.
How should I refer to these automatically generated identifiers from my <p:blockUI> ?
<p:dataTable> also a NamingContainer . Include its identifier as well.
<p:blockUI ... trigger="wfTable:editWatchfolderButtonId"> The row index is present only on the client side, and not on the server side, so it does not matter.
Update : just testing it locally, it really fixes the exception, but it doesn't launch the block user interface at all (PrimeFaces 3.5). Sounds like a bug in PrimeFaces.
At the same time, it’s best to manually start it, as Axel suggested, but then it’s slightly different:
<p:commandLink ... onclick="bui.show()" oncomplete="bui.hide()"> ... <p:blockUI widgetVar="bui" /> Here is a trivial example of using commandLink to block something. Changed example showcases from here
<h:form> <p:commandButton value="blockMe" id="someId" /> <br /> <p:commandLink id="pnlBtn" value="Block" type="button" onclick="bui.show()" /> <br /> <p:commandLink id="pnlBtn2" value="Unblock" type="button" onclick="bui.hide()" /> <p:blockUI block="someId" widgetVar="bui" /> </h:form> For those who are wrong, like me, if BlockUI isn’t shooting, make sure that the “trigger” target is turned on by Ajax. I spent almost the whole day trying to understand why BlockUI didn’t work and found that my goal was set to "ajax =" false ".
You can use the jquery selector.
<p:commandLink styleClass="mybutton-class"> <p:blockUI ... trigger="@(.mybutton-class)">