title: PrimeFaces dataTable with variable columns and specific editable cells
body: <p>I need to create a table where the headers list are brought from a model. The table contents are also stored in the model and p:dataTable loop on the data to show the content based on the column name.</p>
  
  <p>The issue is that I need to make some specific cells editable. For outputting data there is no problem since I use model method which takes both the entity and the column name and return the correct info from the entity based on the column name. The issue is with inputs of the editable cells which I don't know how to set in the entity.</p>
  
  <pre><code>&lt;p:dataTable id="processTable"  var="entity" value="#{home.process.headerEntities}" tableStyle="width:auto" draggableColumns="true" editable="true" editMode="cell"&gt;
  
      &lt;p:columns value="#{home.process.columns}" var="columnHead" &gt;
  
          &lt;f:facet name="header"&gt;
              &lt;h:outputText value="#{columnHead}"/&gt;
          &lt;/f:facet&gt;
  
          &lt;p:cellEditor&gt;
              &lt;f:facet name="output"&gt;
                  &lt;h:outputText value="#{home.process.getData(entity, columnHead)}" /&gt;
              &lt;/f:facet&gt;
              &lt;f:facet name="input"&gt;
                  &lt;p:inputText value="#{home.process.getData(entity, columnHead)}" rendered="#{home.process.isEditable(columnHead)}"  style="width:100%" /&gt;
              &lt;/f:facet&gt;
          &lt;/p:cellEditor&gt;
  
  
      &lt;/p:columns&gt;
  
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <blockquote>
    <p>After change based on BEST ANSWER</p>
  </blockquote>
  
  <pre><code>&lt;p:dataTable id="processTable"  var="entity" value="#{home.process.headerEntities}" tableStyle="width:auto" draggableColumns="true" editable="true" editMode="cell"&gt;
  
                  &lt;p:columns value="#{home.process.columns}" var="columnHead" &gt;
  
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="#{columnHead}"/&gt;
                      &lt;/f:facet&gt;
  
                      &lt;p:cellEditor&gt;
                          &lt;f:facet name="output"&gt;
                              &lt;h:outputText value="#{entity[home.process.columnPropertyMap[columnHead]]}" /&gt;
                          &lt;/f:facet&gt;
                          &lt;f:facet name="input"&gt;
                              &lt;p:inputText value="#{entity[home.process.columnPropertyMap[columnHead]]}" rendered="#{home.process.isEditable(columnHead)}"  style="width:100%" /&gt;
                          &lt;/f:facet&gt;
                      &lt;/p:cellEditor&gt;
  
  
                  &lt;/p:columns&gt;
  
              &lt;/p:dataTable&gt;
  </code></pre>