Skip to content

Disable column sorting

New Discussion
Jason McIntosh
Jason McIntosh asked on Oct 25, 2016 8:51 AM

Call me stupid but I can't seem to track down the property to disable column sorting. I dont want users to be able to use this feature.

A hint please? Big Smile

Many thanks
Jason

Sign In to post a reply

Replies

  • 0
    Cá chu?i
    Cá chu?i answered on Jan 8, 2008 7:29 AM

    UltraGrid provide 2 mode when click Header: Sort or Select Column

    In order to disable Sor, set property HeaderClickAction = Select.
    Ex: UltraWinGrid.DisplayLayout.Override.HeaderClickAction = Select

    If you dont want to Select column after set HeaderClickAction = Select, set property:

     UltraWinGrid.DisplayLayout.Override.SelectTypeCol = None

    Goodluck 

    • 0
      Jason McIntosh
      Jason McIntosh answered on Jan 9, 2008 11:20 PM

      Thanks. Worked like a charm.

      • 0
        Daniel
        Daniel answered on Feb 3, 2008 8:27 PM

        Hmmm… I tried the above proposal to disable column sorting.

         The sorting is indeed disabled, but when clicking a column header, the entire column is marked. I'd like to disable the sorting and avoid marked columns. Is there away to achieve this.

         Kind regards, darhlin Big Smile

      • 0
        Jason McIntosh
        Jason McIntosh answered on Feb 4, 2008 2:00 AM

        When you say the column is marked, are you meaning that the entire column is selected or highlighted or are you meaning that the column header itself is selected? I ask as I have grids where I have both happening.

        Cheers
        Jason

      • 0
        Daniel
        Daniel answered on Feb 4, 2008 7:29 AM

        Hi!

        I mean that the entire column is selected/highlighted. The column header isn't highlighted at all, just the column underneath. 

         /dahrlin 🙂

      • 0
        Mike Saltzman
        Mike Saltzman answered on Feb 4, 2008 2:42 PM

         Setting SelectTypeCol to None (as the sample code above shows) should prevent the column from being selected.

      • 0
        Daniel
        Daniel answered on Feb 4, 2008 8:30 PM

        Thank you all for your assistance!

         Well… right now I am at home and don't have the source code available. But I am sure I've set the properties according to what was described above. 

        Any other properties which could disturb the desired behavior?

         Have a nice day!

      • 0
        Mike Saltzman
        Mike Saltzman answered on Feb 6, 2008 3:12 PM

         Hi,

            If you set set SelectTypeCol to None and clicking the column header still selects the entire column, then something is wrong. There are no other properties that would override this setting. Either you are re-setting this property in code or else your code is doing something else that is causing the behavior. Maybe you are loading a layout? 

      • 0
        Daniel
        Daniel answered on Feb 6, 2008 7:57 PM

         Right Mike, something is wrong. I need to check whether this property is re-set somewhere.

        Sorry for my ignorance, but what do you mean with "loading a layout"?

         /dahrlin 🙂

      • 0
        Daniel
        Daniel answered on Feb 7, 2008 8:08 AM

         I found it! You were right Mike, the properties were re-set in code.

         Thank you guys, dahrlin 🙂

      • 0
        Mike Saltzman
        Mike Saltzman answered on Feb 11, 2008 3:24 PM

        Glad you found it.

        I meant using the Load method on the grid's DisplayLayout.  

      • 0
        Felix George
        Felix George answered on Sep 5, 2013 3:26 AM

        Hi,

         I want to disable colum sorting when double click only. but I need sorting when single click event.

         could it solve? How can it possible? please help me.

        Thanks for your helps.

         

        Thanks and Regards

        Felix G.

         

      • 0
        Mike Saltzman
        Mike Saltzman answered on Sep 5, 2013 2:40 PM

        Hi Felix, 

        I don't think this is possible. A double-click includes two clicks. So the control has no way of knowing that the first click is eventually going to be a double-click.

      • 0
        Pradeep
        Pradeep answered on Nov 25, 2008 1:58 PM

        Hi Mike,

         This is pradeep. I am having one issue with Ultrawingrid regarding sorting. When the data is loaded for the first time, when i click on column header, it  is sorting correctly. But the problem is, when the data is unloaded, this sorting(column sorting) is still enable, which means when i load the data once again, it is displaying data in sorted order(Taking previous column header click as reference). "When the data is unloaded, i need sorting to be disabled,  which means after the data is loaded again, data should be sorted when we click on column header again." I have used the above mention method for sorting the data. So please give me a solution.

        Regards,

        Pradeep 

         

         

      • 0
        Matt Snyder
        Matt Snyder answered on Nov 25, 2008 3:14 PM

        Pradeep,

        If you want to reset the sorted columns when unloading then reloading your data, you will simply need to clear the sorted columns, i.e.:

         this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear();

        -Matt

      • 0
        Pradeep
        Pradeep answered on Nov 26, 2008 7:16 AM

        Hi Matt,

        Thanks for the reply. This is working fine for me.

         Regards,

        Pradeep 

      • 0
        Sergey Knyazev
        Sergey Knyazev answered on Oct 25, 2016 8:51 AM

        To disable column sorting when user click a column,

        set to Event UltraGrid "BeforeSortChange" a Code:

        e.SortedColumns.Clear(); //This code disable sort on every column in the ultragrid

        Have Fun 🙂


      • 0
        Pradeep
        Pradeep answered on Nov 26, 2008 7:22 AM

        Hi,

        I have one more doubt regarding sorting. How to display the data in sorted order(Based on any column number given by us) while displaying data on the UltraWingrid for the first time(With out clicking on ultrawingrid). 

        -Pradeep 

      • 0
        Matt Snyder
        Matt Snyder answered on Nov 26, 2008 3:37 PM

         Pradeep,

        You can add a column to the SortedColumns collection yourself, i.e.:

         this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("My Column Key", false);

        -Matt

      • 0
        Pradeep
        Pradeep answered on Nov 26, 2008 5:18 PM

         Hi,

         I have one more problem.  I am converting a VB application in to Dot Net.  In VB earlier FPSpread is used to display the data and now we are using UltraGrid.  The problem is while sorting coloumns in FPSpread, we can mention the range of coloumns to be sorted as given below:

         fpObjects.SortKey(1) = COL_SEVERITYHIDDEN 

                 fpObjects.col = 1
                fpObjects.Col2 = fpObjects.MaxCols (in present case 7)
                fpObjects.Row = 1
                fpObjects.Row2 = fpObjects.MaxRows (in present case 6)
                fpObjects.Action = ActionSort

        The description for fpObjects.col and fpObjects.Col2 given in fpspread are  "Sets or returns a specific column or specifies the first column of a block of cells on which an operation is to occur." and "Sets or returns the last column of a block of cells on which an operation is to occur."

        Do we have any such properties in Ultra Grid, where we can sort a particular range of coloumns i.e., from coloumn 1 to 7 and from Row 1 to 6.

        Thanks, 

        Pradeep 

      • 0
        Pradeep
        Pradeep answered on Nov 27, 2008 8:34 AM

         Hi,

        I have one more problem.How to give sort indicators to all the columns, when i click on one column header. When i click on 1st column header, sort indicators should be given to all the columns, sorting should be done based on this.

        Regards,

        Pradeep. 

         

      • 0
        Mike Saltzman
        Mike Saltzman answered on Dec 8, 2008 3:35 PM

        Hi Pradeep,

        There's no way to set the SortIndicator on a group of columns all at once. You would have to loop through the columns and set the SortIndicator on each one individually. 

        If you want to change what happens when use changes the sort indicator by clicking a column header, then what you would do is handle the BeforeSortChange event of the grid. In this event, you can example the current sort indicators on each column and see what is changing, then do whatever you want – such as adding additional sorted columns. 

    • 0
      Ahmad Traboulsi
      Ahmad Traboulsi answered on Apr 29, 2011 2:09 PM

      Hello,

      i want to force the users to sort the winGrid by clicking on only 2 specific columns.

      so whenever they click one of these 2 specific columns i want to enable a custom code to sort the grid.

      ex: when they click on column_ItemOrder or Column_Counter the following sorting criteria should take place:

      UltraGridBand band = this.grdBOQ.DisplayLayout.Bands[0];
      band.Columns["ItemOrder"].SortIndicator = SortIndicator.Ascending;
      band.Columns["FullName"].SortIndicator = SortIndicator.Ascending;
      band.Columns["Counter"].SortIndicator = SortIndicator.Ascending;

      if they click on any Other columns than (column_ItemOrder or Column_Counter) i don't want the grid to be sorted in any possible way.

       

      Where should i write the code that you suggested?

       

      Thanks alot

      • 0
        Mike Saltzman
        Mike Saltzman answered on Apr 29, 2011 4:13 PM

        I would use the BeforeSortChange event. The event gives you a collection of column headers with the new SortIndicator applied. So you can examine the collection and if there is a column in there that you do not want to allow the user to sort, you can remove it. If you want to keep three columns sorted together, then you can check the SortIndicator on those columns and make sure they are all synchronized.

        You could also disable sorting on individual columns by setting the SortIndicator property on that column to Disabled.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Jason McIntosh
Favorites
0
Replies
24
Created On
Oct 25, 2016
Last Post
9 years, 10 months ago

Suggested Discussions

Created by

Created on

Oct 25, 2016 8:51 AM

Last activity on

Feb 16, 2026 8:41 PM