1

我有一个 PrimeFaces<p:dataGrid>组件,其中包含可变数量的面板。每个面板都包含许多衍生组件。我在每个面板中都包含一个删除按钮,以允许删除。我在 dataGrid 之外还有一个添加按钮。我没有在按钮上使用immediate="true",而是想出了如何在每个面板中设置每个组件的必需属性。

例如:

required="#{empty param['vehicleGrid:0:btnDelete'] and empty param['btnAdd']}". 

对于 dataGrid 中的每个删除按钮和添加按钮,忽略组件验证。

如果 dataGrid 内部有一个面板,则此方法有效,但它仅引用第一个。我需要动态检查每个面板。也许不是从标记页面查看它,也许我需要用 Java 术语查看它,因为 param 是一个Map<String, String>.

4

1 回答 1

0

将删除按钮组件绑定到视图并UIComponent#getClientId()改为使用。

<h:inputText ... required="#{empty param[deleteButton.clientId]}" />
...
<h:commandButton binding="#{deleteButton}" ... />

这样,将在参数映射中查找正确的客户端 ID,然后无需遍历参数映射。

于 2013-01-14T20:56:04.067 回答