Sorting list items/divs
Sorting list items/divs
Adam Nelson
Posts: 3Questions: 0Answers: 0
I'm trying to do a sort on a set of divs so that if somebody votes up a div (i.e. the score changes) then the entire div moves up.
Does anybody think DataTables is a good solution for this? I'm rather new to jQuery (although I'm committed) and I will likely need other pure table manipulation so I'm thinking it's best to just stick with DataTables which is more powerful rather than try to just do a simple reordering.
Thoughts?
Does anybody think DataTables is a good solution for this? I'm rather new to jQuery (although I'm committed) and I will likely need other pure table manipulation so I'm thinking it's best to just stick with DataTables which is more powerful rather than try to just do a simple reordering.
Thoughts?
This discussion has been closed.
Replies
What you describe is certainly within the realm of what DataTables can do. If you have your DIV's already available, then what you could do is use a custom sorting function (for example: http://datatables.net/examples/example_sorting_plugin.html) to pull the information out of your DIV and sort on that.
An alternative would be to keep the ranking score in a hidden column and then sort your table based on that hidden column (you can either hard code the sorting or use iDataSort - http://datatables.net/usage#iDataSort - to allow sorting on any column, with your ranking be correctly sorted as well).
Let us know how you get on! Sounds interesting!
Allan