2016-11-18 48 views
-1

我有一個p:dataTable看起來像這樣。PrimeFaces的rowEditor除第一次嘗試之外不工作

<p:remoteCommand name="rowEdit" action="#{servicesController.onRowEditCommand}" update="servicesTable" /> 
<p:remoteCommand name="rowEditCancel" action="#{servicesController.onRowEditCancelCommand}" update="servicesTable" /> 

<p:dataTable id="servicesTable" 
      value="#{servicesController.services}" var="service" rowKey="#{service.id}" 
      editable="true" editMode="row"> 

    <p:ajax event="rowEdit" listener="#{servicesController.onRowEdit}" 
      oncomplete="rowEditCommand()"/> 
    <p:ajax event="rowEditCancel" listener="#{servicesController.onRowEditCancel}" 
      oncomplete="rowEditCancelCommand()"/> 
    <p:ajax event="rowSelect" update=":mainMenu" 
      listener="#{servicesController.sessionScopeServiceChanged}"/> 

    <!-- other columns here --> 

    <p:column style="width: 44px;"> 
     <p:rowEditor/> 
    </p:column> 

    <!-- other columns here --> 

    </p:dataTable> 

p:rowEditor第一次正常工作。而且它從第二次不起作用。它進入編輯模式,但複選框和x不響應。

回答

0

兩個命令名稱是錯誤的。

<p:remoteCommand name="rowEdit" ... /> 
<p:remoteCommand name="rowEditCancel" ... /> 

    <p:ajax ... oncomplete="rowEditCommand()"/> 
    <p:ajax ... oncomplete="rowEditCancelCommand()"/> 

我改成了。

<p:remoteCommand name="rowEditCommand" ... /> 
<p:remoteCommand name="rowEditCancelCommand" ... /> 

    <p:ajax ... oncomplete="rowEditCommand()"/> 
    <p:ajax ... oncomplete="rowEditCancelCommand()"/> 
相關問題