Dynamic Toolbar in Datatable column

UI Components for JSF
Post Reply
g.prajeesh77
Posts: 9
Joined: 08 Oct 2011, 06:03
Location: Bangalore, India

05 Dec 2011, 11:21

Hi,

I have a requirement. I have a datatable as follows

Code: Select all

					<p:dataTable value="#{listBranchBean1.rowDataModel}" var="rowItem"
						id="myId" paginator="true"
						paginatorTemplate="{FirstPageLink}{PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}{RowsPerPageDropdown} "
						rowsPerPageTemplate="10,5,2" previousPageLinkLabel="<"
						nextPageLinkLabel=">" widgetVar="branchTable"
						selection="#{listBranchBean1.selectedBranchesPrime}"
						resizableColumns="true"
						sortBy="#{rowItem.columnsValueMap['branchId'].value}">
						<f:facet name="header">
							<p:outputPanel>
								<h:outputText value="Search all fields:" />
								<p:inputText id="globalFilter" onkeyup="branchTable.filter()"
									style="width:150px" />
							</p:outputPanel>
						</f:facet>
						<p:column selectionMode="multiple" style="text-align:left">
							<f:facet name="header">
								<h:outputText value="Select" />
							</f:facet>
							<h:outputText value="#{rowItem.uniqueId}" />
						</p:column>
						<p:column
							rendered="#{listBranchBean1.columnsMap['objectId'].hidden==false}"
							sortBy="#{rowItem.columnsValueMap['objectId'].value}"
							filterBy="#{rowItem.columnsValueMap['objectId'].value}">
							<f:facet name="header">
								<h:outputText
									value="#{listBranchBean1.columnsMap['objectId'].displayLabel}" />
							</f:facet>
							<h:outputText
								value="#{rowItem.columnsValueMap['objectId'].value}" />
						</p:column>
						<p:column
							rendered="#{listBranchBean1.columnsMap['actions'].hidden==false}">
							<f:facet name="header">
								<h:outputText
									value="#{listBranchBean1.columnsMap['actions'].displayLabel}" />
							</f:facet>
							<p:toolbar>
								<p:toolbarGroup>
									<ui:repeat var="action"
										value="#{rowItem.columnsValueMap['actions'].value}">
										<p:commandButton title="#{action}" type="button">
										</p:commandButton>
									</ui:repeat>
								</p:toolbarGroup>

							</p:toolbar>
						</p:column>
					</p:dataTable>
If you see the last column definition, it is an action column and the tool bar should be created based on the users permission for certain actions. As of now I can use only one single type of Command button or a Menu Button. instead of that I should be able to bind to a toolbar by passing the rowItem var in the binding expr

Code: Select all

							<p:toolbar binding="#{listBranchBean1.getActions(rowItem)}">
							</p:toolbar>
It fails

Any help is appreciated

Thanks
Prajeesh
Primeface 3.2/Apache Tomcat-7.0.19/Mojarra 2.1.7 (SNAPSHOT 20120206)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Seo-Ul-But and 25 guests