2

我正在使用带有 Prime Faces 3.2 的 JSF2.0。我有一个数据表,其中有一列有两个命令按钮。第二个命令按钮基于条件呈现。在过滤数据表之前一切正常。一旦过滤了没有渲染属性的第一个命令按钮,就会毫无问题地调用我的 actionListener,而具有渲染属性的第二个命令按钮则不会。

PS:我使用 f:param 而不是 setPropertyActionListener 的原因是由于 primefaces 数据表中的错误在过滤时传递了错误的行 id。

这是我的代码,对此问题的任何见解都会很棒。

<p:column headerText="Column1" filterMatchMode="contains" filterBy="#{item.name}" sortBy="#{item.name}">
                       <h:outputText value="#{item.name}" style="float:left" />
                        <span class="inlineButton"> 
                        <p:commandButton id="selectBtn" icon="select"
                            oncomplete="dialog1.show()" actionListener="#{controller.setItem}">                         
                            <f:param name="itemId" value="#{item.id}"/>
                        </p:commandButton>

                    <p:commandButton id="delBtn" icon="delete"
                        actionListener="#{controller.setItem}"
                        oncomplete="delConfirm.show()"
                        rendered="#{not empty item.id}">                            
                        <f:param name="itemId" value="#{item.id}"/>
                    </p:commandButton>
                    </span>
                </p:column>
4

0 回答 0