Almost all database-driven web sites have one or more web pages that display a set of related records. Most of the time, those pages automatically list the records in a particular order (alphabetically, numerically, chronologically, etc.).
There are occasions, however, when administrative users want to be able to manually rearrange the order in which records or items will be displayed. For example, a news or PR site may want to change the order in which articles are displayed on the main page so that the most important or "hottest" items are at the top. Or a web-based testing site may want to rearrange the order of the questions on a test.
How do you grant such a request?
Well, for starters, you need to add a sorting or order field to the relevant records, something that the users can change the value of without affecting any of the "real" data in the record. That's fairly easy to do.
The hard part is figuring out how to let your users manipulate those order numbers, because it's not sufficient to simple let them change each order number one at a time: what if two records end up with the same order/sorting number (like 5, for example)? Which record comes first?
You need a way for the users to change the order of an item in relation to the items around it.
After having faced this situation several times, I developed a user-interface tool that allows a user to rearrange the items in a list quickly and easily using JavaScript: my List Reorder tool.
I'm making two versions of this tool available for download: a ColdFusion-powered version with ColdFusion code and functions for rendering the item/record list from the database, and an HTML version that developers can utilize with other server-side languages (PHP, Java, etc.).
You can read more about the tool and download it either by clicking on the List Reorder Tool link in my Downloads box on the right, or by clicking on the link below:
List Reorder Tool