I want to allow a drag and drop reorder facility within my app. I'm aware I can do this with acts_as_list, and have followed the Rails Recipe on this. However, due to the way my app is built, the item I want to reorder can't use acts_as_list as it inherits it's position field on create from nested items within another model. When I use acts_as_list, this seems to override the position value meaning the order set in the parent model is lost, child positions are then random.
So I suppose I have two questions:
Can I build an Ajax style drag and drop reorder facility without Acts_As_List?
or
Can I put some kind of if statement with the model to disable acts_as_list on create but enable at all other times? Something like (in english rather than code):
if method = create
child.position = parent.position
else
acts_as_list
end
I'm pretty sure jquery UI has some kind of plugin/module whatever they call them for this like draggable and sortable then maybe they have a success method that you can use ajax to record it's position so that if the user refreshes before a save, it saves it's position in the 'list'.