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.
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:dataTable id="processTable" var="entity" value="#{home.process.headerEntities}" tableStyle="width:auto" draggableColumns="true" editable="true" editMode="cell">
<p:columns value="#{home.process.columns}" var="columnHead" >
<f:facet name="header">
<h:outputText value="#{columnHead}"/>
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{home.process.getData(entity, columnHead)}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{home.process.getData(entity, columnHead)}" rendered="#{home.process.isEditable(columnHead)}" style="width:100%" />
</f:facet>
</p:cellEditor>
</p:columns>
</p:dataTable>
After change based on BEST ANSWER
<p:dataTable id="processTable" var="entity" value="#{home.process.headerEntities}" tableStyle="width:auto" draggableColumns="true" editable="true" editMode="cell">
<p:columns value="#{home.process.columns}" var="columnHead" >
<f:facet name="header">
<h:outputText value="#{columnHead}"/>
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{entity[home.process.columnPropertyMap[columnHead]]}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{entity[home.process.columnPropertyMap[columnHead]]}" rendered="#{home.process.isEditable(columnHead)}" style="width:100%" />
</f:facet>
</p:cellEditor>
</p:columns>
</p:dataTable>