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

GridSortExpression not cleared with custom sorting

4 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 26 Nov 2008, 12:21 PM
Hi,

I have a grid that is using custom sorting.  I am allowing multiple columns to be sorted and using the GridSortExpression to iterate over the selected sort columns.  Everything works but the grid keeps adding additional sorts as the user clicks the various columns.  This would be expected behavor if the user were holding the shift or control keys to denote they want additional sorts to be added. In my case I'm just clicking the columns and it is not clearing the other column sorts as expected.  The sort indicator keeps showing on each column I click. 

What am I doing wrong?

4 Answers, 1 is accepted

Sort by
0
Randy
Top achievements
Rank 1
answered on 26 Nov 2008, 01:27 PM
Ok .  A little more research into this I found that what I am seeing might be expected behavior.  I went through the sorting demos and noticed that on those demos, when you click a column is just adds the sort.  I've seen other grids where the user has to hold a key like shift or control in order to add more sorts.  Without these keys, just clicking, will clear other sorts and add a single sort on the column choosen.  This is what I am after.  Is this an option in the grid? 

Thanks
0
Yavor
Telerik team
answered on 01 Dec 2008, 06:45 AM
Hi Randy,

If you disable the multicolumn sorting for the control, clicking on a column will add the sort icon, and remove it from any other columns where it was added on previous sorting. This can be reproduced in the following example, where you can turn on custom sorting, and disallow multi-column sorting, to achieve the same effect.
Let me know if this is the behavior that you are after.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Randy
Top achievements
Rank 1
answered on 01 Dec 2008, 11:42 AM
Thanks.  Yes. I saw that but I still need multicolumn sorting when the user clicks the shift key.  The best way to describe what I am after is by looking at Microsoft Outlook.  With Outlook when you click columns it performs a simple single column sort.  However, if the user holds the shift key down, then it performs a multicolumn sort. 

How can I achieve this using the RadGrid?
0
Accepted
Yavor
Telerik team
answered on 01 Dec 2008, 12:01 PM
Hello Randy,

Basically, this approach is not provided by default for the control. You can, however, consider a custom approach to the case - combining the onKeyPress handler, together with a handler to trap the click on the header, to perform an AjaxRequest to the server, and set the sort expression manually to the control.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Randy
Top achievements
Rank 1
Answers by
Randy
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or