Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

move datatable rows up and down????  RSS feed

 
kishi kiran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have a requirement like in a Rich datatable,
and i have placed two links up and down in one of the column of each row, here
i wanted to swap rows (move up/ down ) the rows when i click the link on a perticular row. is it possible with jsf/ java script?
can someone give some suggessitions... how to do in eficient way

Thanks
Kiran
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do this sort of stuff with javascript, but it can be very, very messy and prone to error.

The cleanest way to swap rows is simply to swap rows in the DataModel object that backs the dataTable element. You can use AJAX to trigger the event that fires the method which swaps the elements and re-render the table. The actual row-swap logic is the same as for any other array or list: X = row[n], row[n] = row[n+1], row[n+1] = X.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!