Persisting Grid sortable state in database

2 posts, 0 answers
  1. Richard
    Richard avatar
    149 posts
    Member since:
    Feb 2012

    Posted 25 Jan 2017 Link to this post

    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.

  2. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 27 Jan 2017 Link to this post

    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.
Back to Top