Trigger/activate the RowEditor from bean for a primefaces In-Cell editing enabled p:dataTable

前端 未结 9 933
时光说笑
时光说笑 2021-01-02 10:16

I have a primefaces p:dataTable with InCell editing enabled and want to trigger/activate the RowEditor for the newly added row.

Excerpt of XHTML

9条回答
  •  半阙折子戏
    2021-01-02 10:39

    You can add an unique styleClass to the dataTable, and one javascript function in the commandButton:

    So add to the table:

    styleClass="myTable"
    

    And to the button:

    oncomplete="$('.myTable tbody.ui-datatable-data tr:last-child td span.ui-row-editor span.ui-icon-pencil').click()"
    

    And your code will look like this:

    
    
      
              
                
                    ...
                  
            
        ...
              
                      
            
        ...         
    
    

提交回复
热议问题