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

Change default sorting for fields added at runtime

2 Answers 26 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Edwin
Top achievements
Rank 1
Edwin asked on 04 Jun 2014, 02:25 PM
Hi,

Is it possible to programmatically change the default sorting for fields that are added through a RadPivotFieldList?  Currently added fields have default sorting of Ascending (A to Z), but I would like to have no sorting.

Thanks,
Edwin

2 Answers, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 05 Jun 2014, 11:00 AM
Hello Edwin,

What I can suggest you would be to subscribe to the PrepareDescriptionForField event of the DataSourceProvider and set the SortOrder of the new Description to None in the event handler the following way:

private void LocalDataSourceProvider_PrepareDescriptionForField(object sender, PrepareDescriptionForFieldEventArgs e)
{
    if (e.DescriptionType == DataProviderDescriptionType.Group)
    {
        (e.Description as PropertyGroupDescriptionBase).SortOrder = SortOrder.None;
    }
}

Hope this helps.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Edwin
Top achievements
Rank 1
answered on 05 Jun 2014, 11:56 AM
Hi Kalin,

Thanks for the example.  Tested and confirmed to do what I needed.

Regards,
Edwin
Tags
PivotGrid
Asked by
Edwin
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Edwin
Top achievements
Rank 1
Share this question
or