title: Dynamic Column in JSF Datatable JSF2.0
body: <p>I need one help from you. I am using JSF 2.0 and I have a datatable component . One of the column in the datatable is an action column and I need to create a toolbar which contains different type of actionsource component such as command button, link etc. The type of actionsource is determined at run time and number of actionsource is also done at run time. How I can implement this in JSF 2.0</p>
  
  <pre><code>           &lt;p:dataTable value="#{listBranchBean1.rowDataModel}" var="rowItem"
                id="myId" paginator="true"
                paginatorTemplate="{FirstPageLink}{PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}{RowsPerPageDropdown} "
                rowsPerPageTemplate="10,5,2" previousPageLinkLabel="&amp;lt;"
                nextPageLinkLabel="&amp;gt;" widgetVar="branchTable"
                selection="#{listBranchBean1.selectedBranchesPrime}"
                resizableColumns="true"
                sortBy="#{rowItem.columnsValueMap['branchId'].value}"&gt;
                &lt;f:facet name="header"&gt;
                   &lt;p:outputPanel&gt;
                      &lt;h:outputText value="Search all fields:" /&gt;
                      &lt;p:inputText id="globalFilter" onkeyup="branchTable.filter()"
                         style="width:150px" /&gt;
                   &lt;/p:outputPanel&gt;
                &lt;/f:facet&gt;
                &lt;p:column selectionMode="multiple" style="text-align:left"&gt;
                   &lt;f:facet name="header"&gt;
                      &lt;h:outputText value="Select" /&gt;
                   &lt;/f:facet&gt;
                   &lt;h:outputText value="#{rowItem.uniqueId}" /&gt;
                &lt;/p:column&gt;
                &lt;p:column
                   rendered="#{listBranchBean1.columnsMap['objectId'].hidden==false}"
                   sortBy="#{rowItem.columnsValueMap['objectId'].value}"
                   filterBy="#{rowItem.columnsValueMap['objectId'].value}"&gt;
                   &lt;f:facet name="header"&gt;
                      &lt;h:outputText
                         value="#{listBranchBean1.columnsMap['objectId'].displayLabel}" /&gt;
                   &lt;/f:facet&gt;
                   &lt;h:outputText
                      value="#{rowItem.columnsValueMap['objectId'].value}" /&gt;
                &lt;/p:column&gt;
                &lt;p:column
                   rendered="#{listBranchBean1.columnsMap['actions'].hidden==false}"&gt;
                   &lt;f:facet name="header"&gt;
                      &lt;h:outputText
                         value="#{listBranchBean1.columnsMap['actions'].displayLabel}" /&gt;
                   &lt;/f:facet&gt;
                   &lt;p:toolbar&gt;
                      &lt;p:toolbarGroup&gt;
                         &lt;ui:repeat var="action"
                            value="#{rowItem.columnsValueMap['actions'].value}"&gt;
                            &lt;p:commandButton title="#{action}" type="button"&gt;
                            &lt;/p:commandButton&gt;
                         &lt;/ui:repeat&gt;
                      &lt;/p:toolbarGroup&gt;
  
                   &lt;/p:toolbar&gt;
                &lt;/p:column&gt;
             &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>I want to replace the last column with something like</p>
  
  <pre><code>                 &lt;p:toolbar binding="#{listBranchBean1.getActions(rowItem)}"&gt;
                   &lt;/p:toolbar&gt;
  </code></pre>
  
  <p>I appreciate your help</p>
  
  <p>Prajeesh Nair</p>