contextMenu for header cell of dynamic columns of dataTable

UI Components for JSF
Post Reply
tcnguyen
Posts: 36
Joined: 05 Apr 2011, 13:34

11 Jul 2011, 14:37

I have the following dataTable:

Code: Select all

<p:dataTable value="#{bean.rows}" var="row">

	<p:columns value="#{bean.columns}" var="column" columnIndexVar="colIndex">
		<f:facet name="header">
			<h:outputLabel id="taskHeader" value="#{column.task.header}"/>
			<p:contextMenu for="taskHeader" zindex="50">
				<p:menuitem value="Change state of task" onclick="taskDialog.show();">
					<f:setPropertyActionListener value="#{column.task}" target="#{bean.selectedTask}"/>
				</p:menuitem>
			</p:contextMenu>
		</f:facet>
		
		...
		
	</p:columns>
</p:dataTable>

<p:dialog header="Change state of task" widgetVar="taskDialog modal="true">
	<h:form>
		<h:panelGrid columns="2" cellpadding="5">
			<h:outputLabel value="Task:"/>
			<h:outputText value="#{bean.selectedTask.header}" />
				
			<h:outputLabel for="state" value="New state"/>
			<p:selectOneRadio id="state" value="#{bean.newState}">
				<f:selectItems value="#{bean.allStateItems}" />
			</p:selectOneRadio>
			
			<h:outputLabel value=""/>
			<p:commandButton action="save" value="Save"/>
		</h:panelGrid>
	</h:form>
</p:dialog>
After select the context menu "Change state of task", a dialog is opened, but selectedTask is null. Any idea for binding the data of selected header cell?
PrimeFaces 3.0.RC1 / Spring Webflow 2.3.0.RELEASE / SpringSource tc v2.1 / Tomcat 6.0.29.C.RELEASE

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 50 guests