This is a migrated thread and some comments may be shown as answers.

Persisting Grid sortable state in database

1 Answer 206 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 25 Jan 2017, 01:30 PM

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.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 27 Jan 2017, 01:46 PM
Hi,

The project attached in the following code library demonstrates how to store the state in a Session on the server. You can use the same approach to save the grid sortable state in the database.
http://www.telerik.com/support/code-library/save-grid-state-in-session-on-server-side

I hope this information helps. ​​ 

Regards,
Pavlina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or