How to Persist Rows after Reordering in backing bean

UI Components for JSF
Post Reply
Posts: 1
Joined: 07 Feb 2019, 12:30

12 Feb 2019, 16:01

I am using Primefaces Datatable to show the data, i have used draggablerows and trying to save/persist the reordering of the rows in the backing bean

<p:ajax event = onRowReorder listener=#{bean.onRowReorder}/>

I can get the from and to indexes from the event. But, I was not able to persist the row reordering:

<p:dataTable value="#{EmployeeHandler.model.employees}" var="employee" draggableRows="true">

<p:ajax event="rowReorder" listener="#{EmployeeHandler.onRowReorder}"/>

<h:outputText value="#{}"/
<h:outputText value="#{employee.firstName}"/

<h:outputText value="#{employee.lastName}"/

I tried

public void onRowReorder(ReorderEvent event) {
// I want to iterate through all the rows and save the new order of the employees list

Expert Member
Posts: 9377
Joined: 17 Jun 2010, 13:34
Location: Netherlands

14 Feb 2019, 17:33

Lots of discussion about this identical question here ... cking-bean, let's try to keep it in one place
Ronald van Kuijk
PrimeFaces 6.1, PrimeFaces plus 0.0.2 | JbossWildfly 10.1| Mojarra 2.2.13
Fedora 61, Firefox 'most recent'
Read the forum posting rules

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider] and 7 guests