Stack overflow (SO) has a pretty good discussion of the database operations that have to be performed in order to persist user defined row order based on their sortable interactions with grid.
http://stackoverflow.com/questions/330482/best-way-to-save-a-ordered-list-to-the-database-while-keeping-the-ordering
The domain I am working in is the 1-many data design for Master/Detail or Container/Element relationships in SQL server. The master and detail records have identity keys and the detail record foreign keys to the master.
My take away is that the display order can be persisted in two ways.
1-1 persistence data
- Extra field in the detail record: DisplayIndex
- Separate table Sortable<for_detail_table> having only Detail_ID and DisplayIndex
This SO answer indicates three database operations are required to maintain the sortable state on a per sortable change event basis
1-many persistence data as a comma separated list of detail values, constructed from either the detail ids or some other unique over the detail records of a master
- Extra field in the master record: DetailOrderingCSV
- Separate table SortableCSV<for_master_table> having only Master_ID and DetailOrderingCSV
This SO answer calls this approach pragmatic, and this answer talks about separate tables
I was wondering if anyone has an example VS solution demonstrating remote persistence of sortable ordering.
Also would like to hear other ideas.