in reply to Re: How to let a user sort a list on a web page
in thread How to allow a user to reorder rows from a database using a web form?

I guess I haven't been clear enough about the sorting requirements. Perhaps an example would help...

Let's say each row in the table represents something like a task or project.

One person, like a manager or something, would have the ability to bring up a form in which each row represents a task/project.

His responsibility is to decide the order in which these tasks/projects should be completed. So he's dealing with entire rows, not the individual cells or columns.

What can I build that make it easy for him to log in, get his set of rows, easily rearrange them to the order he wants, and then capture the ordering he has specified?

Thanks!

  • Comment on Re^2: How to let a user sort a list on a web page

Replies are listed 'Best First'.
Re^3: How to let a user sort a list on a web page
by GrandFather (Saint) on Dec 21, 2010 at 20:24 UTC

    Add a SortOrder column to your database and let the manager edit the values in that column for each row. Each time you fetch the data for display append "Order By SortOrder" to the SQL.

    True laziness is hard work

      Personally, if I were a manager, I would rather like to simply click-n-drag the individual rows up and down. Somewhat like you can rearrange Firefox' tabs, only vertically.  Having to enter numbers for this seems a little web-1.0-ish to me.

      Unfortunately, the already mentioned jQuery datatables plugin doesn't provide that functionality, AFAICT (I'd like to be proven wrong) - although it's an otherwise very neat widget.  So, if anyone is aware of some other js library which can do it, please tell...

        There are two parts to the problem - persisting the sort order and setting the sort order. Persisting the sort order is server side and easily handled as suggested. Setting the sort order requires client side scripting support and is the harder problem to solve, and also somewhat off topic for this site (although I don't see that as an impediment to someone here providing a solution).

        True laziness is hard work