datatable with filtering+sorting wrong selection

UI Components for JSF
Post Reply
jskjons@rei.com
Posts: 2
Joined: 26 Apr 2011, 17:37

26 Apr 2011, 18:05

I have a datatable that allows both filtering and sorting on most columns and has one column with command links that do actions on the row. When you filter by one column then sort by another clicking on the command links gets gets the wrong row. Here's the relevant code snippet:

Code: Select all

<h:form id="valuesForm">
    <p:dataTable id="values" value="#{applicationPropertyBean.values}"
         var="v" rowStyleClass="#{val.value.active ? '' : 'disabled'}"
	 style="font-size:small">
         <p:column headerText="Environment" sortBy="#{v.environment.name}" filterBy="#{v.environment.name}">
	     #{v.environment.name}
	 </p:column>
         <p:column headerText="Value" sortBy="#{v.value.value}" filterBy="#{v.value.value}">
	     #{v.value.value}"
	 </p:column>
         ....
         <p:column headerText="Actions" rendered="#{applicationPropertyBean.editPermitted}">
		<h:panelGrid columns="1" columnClasses="no-border">
			<p:commandLink value="Edit" oncomplete="valueDlg.show()" update="valueForm:valueGrid">
			     <f:setPropertyActionListener target="#{applicationPropertyBean.value}" value="#{v}" />
			</p:commandLink>			
			<p:commandLink value="Delete" oncomplete="deleteConfirm.show()">
			     <f:setPropertyActionListener target="#{applicationPropertyBean.value}" value="#{v}" />
			</p:commandLink>			
		</h:panelGrid>
	  </p:column>
    </p:dataTable>
</h:form>
When the edit button is clicked the wrong value is passed in on the setPropertyActionListener.

SebastianD
Posts: 24
Joined: 04 Dec 2010, 14:52
Location: Poland
Contact:

10 Jul 2011, 19:37

Mark ApplicationPropertyBean class as @SessionScoped - it should help.

jskjons@rei.com
Posts: 2
Joined: 26 Apr 2011, 17:37

21 Jul 2011, 19:35

It's view scoped currently, so it should still be staying in scope.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

22 Jul 2011, 00:09


Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 39 guests