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

Sorting after and client-side columns reordering

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BliC
Top achievements
Rank 1
BliC asked on 22 Jan 2013, 08:11 PM
Hello!
In my project I use RadGrid with dynamic columns creation and configuration. Available columns is stored in database and columns set is depend on user group. User can resize, hide/show and reorder columns and configuration is persisted in db using REST ajax requests to service. Filtering and grouping also is enabled. Dynamically created at PageInit event Grid is wrapped by ASP.NET Update panel and binded at server side using NeedDataSource event. Grid.MasterTableView.EnableColumnsViewState = false (otherwise grid throws exception at postback request). All is OK untill user will not start columns reoredering. If user reorder columns, new order will be stored at db, but Ids of the links in column headers that responsible for invoking sort operation still the same... so at the next postback request (for example - rebind) we will get sorting not on the target column, but on the column that be place at that position before reordering. In you sample demo with client-side columns reordering sorting is disabled... Because of grid doesn't support sorting with enabled client-side reordering?

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 25 Jan 2013, 02:50 PM
Hi Dmitriy,

The problem you are experiencing is due to the disabled ViewState of the columns. When enabling column reordering, the table view's EnableColumnViewState property must be set to True. This is also mentioned in this help article. When the the ViewState is disabled the sort event will not fire and it is expected to get such behavior. That said you have to set EnableColumnViewState to true in order to make things work correctly.

Kind regards,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
BliC
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or