Skip to main content
Inspiring
July 14, 2008
Question

Changing order of recordset results

  • July 14, 2008
  • 1 reply
  • 352 views
Hi all,

What is the best way to allow a user to change the order of a recordset?

If the recordset contains
ID Title
01 Movies
02 Music
03 Photos
04 Smells
05 Colours

If I have a page which lists these items and I want to allow the user to change the order, to put Smells at the top of the list, is there a native way of doing this in CF8? Kind of like changing the order of columns in a cfgrid tag, but to change the order of the rows rather than columns?

Cheers,
Paul
    This topic has been closed for replies.

    1 reply

    Participating Frequently
    July 14, 2008
    One method woud be to change the ORDER BY in your original query, or Q-of-Q, that allows you to specify which column(s) that you wish to sort by. In other words, use CFIF to allow you to vary which columns you want to sort by based on user selection.

    Or, double click on the column header that you want to sort on in your cfgrid....

    Phil
    Inspiring
    July 14, 2008
    Hi Phil,

    Thanks for your reply.

    What I am aiming to do is allow the user to shuffle the order of the recordset and then save that as the new order.

    In my prvious example, a way to move smells to the top (become the first result to be shown) and save it there. Then maybe to move smells to the 3rd and photos to the top, then save that order).

    In CFGrid you can drag a column, to say switch the ID and the Title, but I am looking to do similar to the rows, ratherthan the columsn.

    Any suggestions?

    Thanks,
    Paul