Jsf Primefaces数据表行编辑器

Jsf Primefaces数据表行编辑器,jsf,primefaces,Jsf,Primefaces,我使用Primefaces'p:dataTable来显示一个可编辑的表。是否有任何方法可以检测何时单击了p:rowEditor图标?我之所以需要它,是因为我想在编辑模式下禁用为行删除而添加的p:commandLink 下面是.xhtml: <p:dataTable paginatorAlwaysVisible="true" paginator="true" paginatorPosition="top"

我使用Primefaces'
p:dataTable
来显示一个可编辑的表。是否有任何方法可以检测何时单击了
p:rowEditor
图标?我之所以需要它,是因为我想在编辑模式下禁用为行删除而添加的
p:commandLink

下面是.xhtml:

<p:dataTable paginatorAlwaysVisible="true"
                 paginator="true"
                 paginatorPosition="top"
                 paginatorTemplate="{CurrentPageReport} {PageLinks} {RowsPerPageDropdown}"
                 rowsPerPageTemplate="10,25,50"
                 rows="10"
                 editable="true"
                 value="#{userController.allUsers}"
                 var="user"
                 > 
        <p:ajax event="rowEdit" listener="#{userController.onEdit}"/>
        <p:column headerText="First Name">
            <p:cellEditor>
                <f:facet name="output">
                    <h:outputText value="#{user.firstname}"/>
                </f:facet>
                <f:facet name="input">
                    <h:inputText value="#{user.firstname}"/>
                </f:facet>
            </p:cellEditor>
        </p:column>

        //. . . some other data columns

        <p:column headerText="Options">
            <p:rowEditor/> <br/>
            <p:commandLink id="deleteLink" styleClass="ui-icon ui-icon-trash"  action="#{userController.deleteUser(user.userId)}"/>
        </p:column>
谢谢

只需在您的专栏中使用另一个

<p:column headerText="Options">
  <p:rowEditor/>
  <p:cellEditor>
    <f:facet name="output">
      <p:commandLink id="deleteLink" styleClass="ui-icon ui-icon-trash"  action="#{userController.deleteUser(user.userId)}"/>
    </f:facet>
    <f:facet name="input">

    </f:facet>
  </p:cellEditor>
</p:column>


我还建议您将deleteLink放在另一列中。

单击p:rowEditor时要检测的事件是:

<p:ajax event="rowEditInit" listener="#{Bean.someListener}" />

经过大量研究,event=“rowEditInit”是捕捉可编辑行的铅笔点击的正确方法


谢谢

链接在哪里?在同一行还是在桌子外面?另外,请发送您的xhtml和javaplease@KeremBaydo你好!我添加了丢失的源代码(我的错误)。删除操作的链接在同一行中,在
p:rowdeditor
旁边。隐藏链接是一个好主意,但当我这样做时,删除操作不再有效。它只是不调用bean方法。如果发生此事件,我如何获取单击编辑的对象?
<p:ajax event="rowEditInit" listener="#{Bean.someListener}" />