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

get sortorder position of a GridViewColumn

5 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Koslik
Top achievements
Rank 1
Richard Koslik asked on 05 Nov 2010, 09:03 AM
Hello!

My problem is the following:
I use a RadGridView to display data for the user and our project is designed with MVVM. it's possible to get the SORTINGSTATE for each column of the GridView, but I find no possibilty to get the position of the sorted column. Because in a GridView it's possible to sort more than one column and so I need the order of the sorted columns.

What I need is:
- all sorted columns of a GridView
- for each column the sortingstate (ascending/descending)
- for each column the sorting position

Has anyone a idea how I can get the sort position for each column??


Best regards, Richard

5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 05 Nov 2010, 10:15 AM
Hi Richard Koslik,

You may walk through the columns collection of the grid and check each of the column's sorting state by the corresponding property - SortingState. Considering the order of the columns, you may use the property - DisplayIndex.
 

Greetings,
Maya
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
Richard Koslik
Top achievements
Rank 1
answered on 05 Nov 2010, 01:35 PM
Hi,

thanks for your answer.

I tried the displayindex, but it's only the index of the column on which position in the grid the column is displayed. What I needed, was an index for the sorting order, but I have already found a solution.

Now I created a DICTIONARY list of type <string,SortingState>. If the user now clicks onto a  column header for sorting, the SORTING event of the RadGridView is called. There I add the column (fieldname) and the sortingstate into my dictionary. So I get a list of my fieldnames in the right sorting order.

One strange thing is still apearing ... if I normally click onto the first column for sorting a additional sign " ^ " is displayed, but if I make a Binding on SORTINGSTATE and set the binding variable in MVVM the sign is not shown. It looks like the GridColumns doesn't really work, if using Bindings on their properties. There are also problems with setting the WIDTH and ISVISIBLE.

best regards, Richard
0
Maya
Telerik team
answered on 11 Nov 2010, 10:13 AM
Hi Richard Koslik,

May you reveal some more details about your exact requirements and expected behavior ? Why do you require to bind the SortingState ? What is the expected by your behavior ? 
Considering the binding to isvisible and width properties - again it depends on you settings and requirements.
 

Greetings,
Maya
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
Richard Koslik
Top achievements
Rank 1
answered on 12 Nov 2010, 10:37 AM
Hello!

I had an idea to use one GridView to display several different tables depending on a button you can click. So I would have had to change the displayed columns and settings (width or sorting). But I don't need it anymore, thanks for your answer.

Regards, Richard
0
Maya
Telerik team
answered on 12 Nov 2010, 01:19 PM
Hello Richard Koslik,

In case you decide to follow up your initial idea, you may implement the approach presented in our Save and Load GridView Layout article and example. Thus you will be able to keep the desired information about the settings of a particular grid and load it afterwards.
 

Greetings,
Maya
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
Richard Koslik
Top achievements
Rank 1
Answers by
Maya
Telerik team
Richard Koslik
Top achievements
Rank 1
Share this question
or