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

前端 未结 9 918
时光说笑
时光说笑 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:31

    I used the execute(..) method of class RequestContext in my create method. This allowed me to first calculate the index of the row to go into edit mode and to include it dynamically in the javascript:

    RequestContext.getCurrentInstance().execute("jQuery('span.ui-icon-pencil').eq(" + rowToEditIndex + ").each(function(){jQuery(this).click()});");
    

    Hope this helps.

提交回复
热议问题