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

cancel in CustomSorting

5 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Midav Obuarez
Top achievements
Rank 1
Midav Obuarez asked on 18 May 2010, 03:40 AM
Hi,
I implemented Custom Sorting in GridView and it all works fine.
The only problem is that if I set e.Cancel = true; in the Sorting Event (as shown in documentation) Ascending and Descending markers don't appear in the Sorted Column Title. If I don't set e.Cancel everything works fine.
My only concern is that documentation says to set e.Cancel = true; when implementing custom sorting.

Thank you,

Midav

5 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 18 May 2010, 07:04 AM
Hi Midav Obuarez,

If e.Cancel is not set to true RadGridView will also sort the data. If you would like to perform custom sorting you should set e.Cancel as true. Once you do that RadGridView will not sort the data. The EventArgs of the Sorting event will also allow you to configure the sorting state of the column. For example:

void playersGrid_Sorting(object sender, GridViewSortingEventArgs e)
{
    e.Cancel = true;
  
    // perform Descending sorting
  
        // set sorting state of the column
    e.NewSortingState = SortingState.Descending;
}


Kind regards,
Milan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Midav Obuarez
Top achievements
Rank 1
answered on 18 May 2010, 08:20 PM
Milan,

Thank you for your quick response. The way you described the process is also exactly how I undertsood it, unfortunately if you set e.Cancel=true, then the grid will ignore the settings of NewSortingState, so asc/desc marker will not appear in the column header.
So essentially I do things as you show in your email example, but it doesn't work properly.
If I don't set e.Cancel=true, everything works perfect but I guess internally the grid does some additional sorting which is not necessary in my case since I handle this myself. Here is my grid xaml, just in case.

<

 

Controls:RadGridView x:Name="dbgrdMain" Margin="3,0,0,0" IsFilteringAllowed="False" ShowGroupPanel="False" CanUserReorderColumns ="False" IsReadOnly="False" Sorting="dbgrdMain_Sorting" />

 


Thank you,

Midav 
0
Milan
Telerik team
answered on 19 May 2010, 08:54 AM
Hello Midav Obuarez,

That is very strange - setting NewSortingState in the Sorting event should be reflected in the column header. Could you please take a look at the application that I have attached to this thread - it will always set the sorting state to descending. 


Best wishes,
Milan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Midav Obuarez
Top achievements
Rank 1
answered on 22 May 2010, 04:31 AM
Milan,

Your example project does work for me as expected and it seems I do the same thing in my code so it's a mystery  for me why it doesn't work in my case, but thanks to your help I know it's not the problem with the RadGridView control, so I'll dig deeper into my code, maybe I'll find something.

Thanks again,

Midav
0
Milan
Telerik team
answered on 24 May 2010, 05:58 AM
Hi Midav Obuarez,

If you could send us you code we can have a look to try to find the problem. I believe we had a bug which prevented the column header of being updated but this bug is fixed in version 2010.1 422.


Kind regards,
Milan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Midav Obuarez
Top achievements
Rank 1
Answers by
Milan
Telerik team
Midav Obuarez
Top achievements
Rank 1
Share this question
or