get sortorder position of a GridViewColumn

6 posts, 0 answers
  1. Richard Koslik
    Richard Koslik avatar
    71 posts
    Member since:
    Apr 2010

    Posted 05 Nov 2010 Link to this post

    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
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 05 Nov 2010 Link to this post

    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
  3. DevCraft banner
  4. Richard Koslik
    Richard Koslik avatar
    71 posts
    Member since:
    Apr 2010

    Posted 05 Nov 2010 Link to this post

    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
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 11 Nov 2010 Link to this post

    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
  6. Richard Koslik
    Richard Koslik avatar
    71 posts
    Member since:
    Apr 2010

    Posted 12 Nov 2010 Link to this post

    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
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 12 Nov 2010 Link to this post

    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
Back to Top
DevCraft banner