[英]How to reference p:commandLink in p:dataTable from p:blockUI trigger?
This is not working 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 that I am getting is: 我得到的错误是:
Cannot find component with identifier "editWatchfolderButtonId"
. Cannot find component with identifier "editWatchfolderButtonId"
。
When I used Firebug to look for the ID, I discovered that every row has a different ID: 当我使用Firebug查找ID时,我发现每行都有不同的ID:
wfMgtForm:wfTable:0:editWatchfolderButtonId
wfMgtForm:wfTable:1:editWatchfolderButtonId
wfMgtForm:wfTable:2:editWatchfolderButtonId
wfMgtForm:wfTable:3:editWatchfolderButtonId
wfMgtForm:wfTable:0:editWatchfolderButtonId
wfMgtForm:wfTable:1:editWatchfolderButtonId
wfMgtForm:wfTable:2:editWatchfolderButtonId
wfMgtForm:wfTable:3:editWatchfolderButtonId
etc. 等等
How should I reference this auto created IDs from my <p:blockUI>
? 我应该如何从<p:blockUI>
引用这个自动创建的ID?
The <p:dataTable>
is also a NamingContainer
. <p:dataTable>
也是一个NamingContainer
。 Include its ID as well. 也包括其ID。
<p:blockUI ... trigger="wfTable:editWatchfolderButtonId">
The row index is only present in client side, not in server side, so that's not relevant. 行索引仅存在于客户端,而不是服务器端,因此不相关。
Update : just tested it locally, it indeed fixes the exception, but it didn't trigger the block UI at all (PrimeFaces 3.5). 更新 :刚刚在本地测试它,它确实修复了异常,但它根本没有触发块UI(PrimeFaces 3.5)。 Look like a bug in PrimeFaces. 看起来像PrimeFaces中的一个错误。
In the meanwhile, your best bet is to manually trigger it as suggested by Aksel, but then somewhat different: 同时,你最好的选择是按照Aksel的建议手动触发它,但后来有些不同:
<p:commandLink ... onclick="bui.show()" oncomplete="bui.hide()">
...
<p:blockUI widgetVar="bui" />
Here is a trivial example of using commandLink to block something. 这是使用commandLink阻止某些事情的一个简单示例。 Modified the showcase example 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 as clueless as myself, if BlockUI is not firing, check that the "trigger" target has Ajax enabled. 对于那些像我一样无能为力的人,如果BlockUI没有触发,请检查“触发器”目标是否启用了Ajax。 I spent almost a day trying to figure out why BlockUI did not fire and found that I had its target configured as 'ajax="false"'. 我花了将近一天的时间试图找出为什么BlockUI没有触发,并发现我的目标配置为'ajax =“false”'。
You can use a jquery selector. 您可以使用jquery选择器。
<p:commandLink styleClass="mybutton-class">
<p:blockUI ... trigger="@(.mybutton-class)">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.