Skip to content

Disable sorting in grid

New Discussion
Roman Gordienko
Roman Gordienko asked on Jan 4, 2016 9:45 PM

I need to turn off the sort of records in the grid …. but I want to display the sort indicator … I am passing record in the grid is already sorted and I do not need internal sort ….

Sign In to post a reply

Replies

  • 0
    Maya Kirova
    Maya Kirova answered on Dec 23, 2015 10:33 AM

    Hello Roman, 

    Thank you for posting in our forum.

    Could you specify which grid you’re referring to? The Asp.net WebDataGrid, the IgniteUi igGrid or some other grid?

    I’m looking forward to your reply. 

    Best Regards,

    Maya Kirova

    Infragistics, Inc.

    http://www.infragistics.com/support

     

     

    • 0
      Roman Gordienko
      Roman Gordienko answered on Dec 23, 2015 10:56 AM

      Hello, Maya
      my question about Infragistics.Win.UltraWinGrid.UltraGrid

      • 0
        Milko Venkov
        Milko Venkov answered on Dec 28, 2015 10:39 AM

        Hello Roman,

        Thank you for your feedback.

        In order to disable sorting on the columns by clicking on the columns headers you may set HeaderClickAction property of the Override to Select. You may use code like this:

        e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

        However, this will hide also SortIndicators. To show them you need to add sorted columns to SortedColumns collection of the band. You may use code like this for each sorted column:

        e.Layout.Bands[0].SortedColumns.Add(e.Layout.Bands[0].Columns[1], false);

        One more point. When you set HeaderClickAction to Select if the user clicks on the column’s header the entire column will be selected. If this is not accepted behavior you may set SelectTypeCol propert of the Override to None like this:

        e.Layout.Override.SelectTypeCol = SelectType.None;

        Another approach achieve this behavior is to cancel BeforeSortChange event of the grid.

        In the attached sample project I have implemented this. Please check my sample an let me know if this is what you are looking for or if I am missing something.

        Thank you for using Infragistics Controls.

        CAS-168057-R7K7V1_01

      • 0
        Mike Saltzman
        Mike Saltzman answered on Jan 4, 2016 9:45 PM

        Hi Roman,

        I noticed that Milko’s sample shows the sort indicator, but it’s also performing a sort on the column, which I don’t think you want. The grid isn’t really designed to show a sort indicator without letting the user change it.

        I found a way to trick the grid by modifying the sample a little bit and I have attached it here. Basically, I set the HeaderClickAction to ExternalSortMulti, which tells the grid to show the expansion indicators, but not sort. Then… in order to prevent the user from changing it, I wait for the grid to paint the first time and then change HeaderClickAction to Select.

        This is a bit of a hack and I’m not sure how reliable it is.

        An alternative solution might be to use apply an image to the column header of your own sort indicator.

        CAS-168057-R7K7V1_01 (1)

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Roman Gordienko
Favorites
0
Replies
4
Created On
Jan 04, 2016
Last Post
10 years, 8 months ago

Suggested Discussions

Created by

Created on

Jan 4, 2016 9:45 PM

Last activity on

Feb 23, 2026 10:13 AM