This content has been marked as final. Show 2 replies
You didn't mention how the user calls the page to start with. If you are using a form, you can have "sort by" form fields and process them accordingly.
To change the sort order after the page has been loaded, you don't have to pass anything back to the database. You can change the display using js. One of my co-workers wrote a page where you can sort data in an html table by clicking on the column header.
This is for a CMS, the part that allows an admin to change the sort order of sub-navigation items associated with a particular top-navigation item on the pages that the public can access. (The sub-navigation items are articles.)
Currently, the idea is that each top navigation item uses js to display all sub-nav items associated with that top-nav, and at the top of the list of sub-nav items is a link for changing the SO of those sub-nav items. When the top-nav clicked is for, say, "About", then all sub-nav items (clickable for editing) under the heading of "About" appear with a link at the top of the list that says "Change Sort Order for: About"; when clicked this will open a page that (ideally, if I can find the js for it) contains a select box that has a size equal to the number of sub-nav items so there is no scrollbar, and contains all sub-nav items in the current sort order from top to bottom; the js allows the user to click-n-drag the items to the order they want them in, then click a submit button to make the changes in the database. Each sub-nav item in the database has a sortOrder column, datatype int; this is the column that needs updating. I'm just not sure how to make sure that the ID associated with each sub-nav item gets the correct value in the sortOrder column.
So it will be more than just "click this header to sort data according to this column" (which I'd use CF for that, not js). The client wants a customisable sort order for the sub-nav items (first item = 1, second item = 2, etc.; change the way the items appear on the public side pages.)