Sean Payne wrote:
Suppose gui-users wanted to drag and drop rows in a table so that they could shuffle it anyway that they wanted so that the rows maintained that order the next time they accessed the table. Can this be done without updating alot of other rows? How is this normally handled?

The ideas I have are
1. to use a field (possibly the primary key) and then reorder the lower part of the table each time a row is moved.
2. to deal with it a separate table - maintain an position->key table
3. do something like have an "magical-order-field" which keeps a string that when SORTed BY maintains the desired order. so to insert a row between "a" and "b" set it's magical-order-field to "aab"



Sean,

You might want to combine your last two ideas and maintain a "magical order field" in a separate table related by the primary id of the main table. I would suggest using floating point numbers for your "magical order field" since you can insert a value between two other values by taking the average of the two values. This way there is no need to renumber all the items after the newly positioned item when the user moves an item. This is somewhat like the Dewey decimal system used by libraries to order books on shelves. Using a separate table would also allow multiple users to each have their own preferred sort order maintained by your application.

HTH
Dennis Cote


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to