title: Trigger/activate the RowEditor from bean for a primefaces In-Cell editing enabled p:dataTable
body: <p>I have a primefaces <code>p:dataTable</code> with <a href="http://www.primefaces.org/showcase/ui/datatableEditing.jsf" rel="noreferrer">InCell editing enabled</a> and want to trigger/activate the RowEditor for the newly added row.</p>
  
  <p><strong>Excerpt of XHTML</strong></p>
  
  <pre><code>&lt;p:commandButton id="btnAddEntry" value="Add new row" actionListener="#{myBean.addNewCar}" ... update="carTable growl" process="@this carTable ..."/&gt;
  
  &lt;p:dataTable id="carTable" var="car" value="#{myBean.cars}" ... editable="true"&gt;  
          &lt;p:column ...&gt;  
              &lt;p:cellEditor&gt;
                  ...
              &lt;/p:cellEditor&gt;  
          &lt;/p:column&gt;
      ...
          &lt;p:column ...&gt;  
                  &lt;p:rowEditor /&gt;  
          &lt;/p:column&gt;
      ...         
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>Here is what i have so far for the <strong>bean method</strong>:</p>
  
  <pre><code>public void addNewCar() {
  
      Car newCar = new Car();
      cars.add(newCar);
  
      FacesContext facesContext = FacesContext.getCurrentInstance();
      UIComponent uiTable = ComponentUtils.findComponent(facesContext.getViewRoot(), "carTable");
      DataTable table = (DataTable) uiTable;
  
      final AjaxBehavior behavior = new AjaxBehavior();    
      RowEditEvent rowEditEvent = new RowEditEvent(uiTable, behavior, table.getRowData());
      rowEditEvent.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
      table.broadcast(rowEditEvent);
  }
  </code></pre>
  
  <p>i don't know </p>
  
  <ol>
  <li>if this is the correct approach</li>
  <li>in case yes, which object to pass to the constructor <code>RowEditEvent(UIComponent component, Behavior behavior, Object object)</code> as the 3rd parameter</li>
  </ol>