Sorting list items/divs

Sorting list items/divs

Adam NelsonAdam Nelson Posts: 3Questions: 0Answers: 0
edited March 2009 in General
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.



  • allanallan Posts: 60,302Questions: 1Answers: 9,791 Site admin
    Hi Adam,

    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: 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 - - to allow sorting on any column, with your ranking be correctly sorted as well).

    Let us know how you get on! Sounds interesting!

This discussion has been closed.