Best way to allow the User to define a Table’s Order?
We are using SQL Server 2005 and DevExpress controls.
We have a table that contains the following:
- Process A
- Process B
- Process C
- Report A
- Report B
- Report C
We want to allow the user to change the order to anything they want.
Here is one example:
- Process C
- Process A
- Process B
- Report B
- Report A
- Report C
To accommodate this we added a DisplayOrder (INT) field to the table that is maintainted by the our application.
Is using an INT field the best solution for a user defined order?
Are there any other methods to accomplish this?
The reason, I am asking, is in our current application it takes about 1 second to move a row down (or up). I am about to crack open the code to see why it is taking so long and if you Stack Overflow gurus have any good ideas, I might implement them at that time.
If you are curious, here is how I believe our application allows editing of the DisplayOrder:
- Load the table into a GridView
- Select a row
- Clicking a Move Down button (there is also a Move Up button)
- The Click Event will swap DisplayOrder of the current row with the row underneath it.
- The change, to both of the records, are written back to the database
- This takes about 1 second per click (i.e. 10 clicks equal 10 seconds)