问题描述
这对我不起作用:
<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>
我得到的错误是:
Cannot find component with identifier "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
等
wfMgtForm:wfTable:0:editWatchfolderButtonId
wfMgtForm:wfTable:1:editWatchfolderButtonId
wfMgtForm:wfTable:2:editWatchfolderButtonId
wfMgtForm:wfTable:3:editWatchfolderButtonId
etc.
如何从我的<p:blockUI>
引用此自动创建的ID?
How should I reference this auto created IDs from my <p:blockUI>
?
推荐答案
<p:dataTable>
也是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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!