如何从 p:blockUI 触发器引用 p:dataTable 中的 p:commandLink? [英] How to reference p:commandLink in p:dataTable from p:blockUI trigger?
问题描述
这对我不起作用:
<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>
我得到的错误是:
找不到标识符为editWatchfolderButtonId"的组件
.
当我用 Firebug 查找 ID 时,我发现每一行都有不同的 ID:
When I used Firebug to look for the ID, I discovered that every row has a different ID:
wfMgtForm:wfTable:0:editWatchfolderButtonId
wfMgtForm:wfTable:1:editWatchfolderButtonId
wfMgtForm:wfTable:2:editWatchfolderButtonId
wfMgtForm:wfTable:3:editWatchfolderButtonId
等
我应该如何从我的
引用这个自动创建的 ID?
How should I reference this auto created IDs from my <p:blockUI>
?
推荐答案
也是一个 NamingContainer
.也包括它的 ID.
The <p:dataTable>
is also a NamingContainer
. Include its ID as well.
<p:blockUI ... trigger="wfTable:editWatchfolderButtonId">
行索引仅存在于客户端,而不存在于服务器端,因此无关.
The row index is only present in client side, not in server side, so that's not relevant.
更新:刚刚在本地进行了测试,确实修复了异常,但根本没有触发块 UI(PrimeFaces 3.5).看起来像是 PrimeFaces 中的一个错误.
Update: just tested it locally, it indeed fixes the exception, but it didn't trigger the block UI at all (PrimeFaces 3.5). Look like a bug in PrimeFaces.
与此同时,最好的办法是按照 Aksel 的建议手动触发它,但随后又有所不同:
In the meanwhile, your best bet is to manually trigger it as suggested by Aksel, but then somewhat different:
<p:commandLink ... onclick="bui.show()" oncomplete="bui.hide()">
...
<p:blockUI widgetVar="bui" />
这篇关于如何从 p:blockUI 触发器引用 p:dataTable 中的 p:commandLink?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!