Home > nestedsortable_jquery

nestedsortable_jquery

Nestedsortable_jquery is a project mainly written in JavaScript, it's free.

mjsarfatti.com's nested sortable with a few changes

h1. Nested Sortable - jQuery

This is "mjsarfatti.com's":http://mjsarfatti.com/sandbox/nestedSortable/ nested sortable with a few changes:

h2. Change 1: serialize

Serialize now supports the position or order of items as well. This hasn't been tested vigorously (I don't know what configuration options might not work), but it has changed from:

itemName[23]=12

to

itemName[itemName_23][position]=0&itemName[itemName_23][parent_id]=itemName_12

And this is how you'd parse through the returned params to your server in Ruby assuming your itemName is 'page':

params['page'].each do |page_id, attributes|
  id = page_id.gsub(/D+/, "") # get ID for integer only
  page = Page.find(id)
  page.position = attributes['position']
  page.parent_id = attributes['parent_id'].gsub(/D+/, "")
  page.save
end
Previous:SpringDynamic