Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4695
Some questions in Ultragrid
posted

(1) if I have the ultragrid with date and time as 2 fields, how to sort by date and then time? Two columns sorting. And disable the sorting change when runtime.

 

(2) I have fixed the columns in ultragrid as attached screen. How to make it would not change when runtime? Invisble the pin or disable it the change in runtime 

  • 48586
    posted

    Hello, ­­­­­

     

    I am just checking about the progress of this issue. Let me know If you need any further assistance on this  issue?

     

    Thank you for using Infragistics Components.

  • 469350
    Suggested Answer
    Offline posted

    1) The best thing to do would be to sort your data source before binding the grid - assuming your data source has support for sorting. Then you never have to use the grid's sorting capabilities at all. 

    If you want to sort columns in the grid, then you simply add those columns to the SortedColumns collection.


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                UltraGridLayout layout = e.Layout;
                UltraGridBand band = layout.Bands[0];
                UltraGridOverride ov = layout.Override;

                band.SortedColumns.Add("Date", false);
                band.SortedColumns.Add("Time", false);

                ov.HeaderClickAction = HeaderClickAction.Select;
            }

    To prevent the user from changing the sort order, set the HeaderClickAction to something other than sort.

    2) Turn off the fixed header indicators using the FixedHeaderIndicator property.


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                UltraGridLayout layout = e.Layout;
                UltraGridBand band = layout.Bands[0];
                UltraGridOverride ov = layout.Override;

                band.SortedColumns.Add("DateTime 1", false);
                band.SortedColumns.Add("DateTime 2", false);

                // This is not really neccessary, since Select is the default.

                layout.UseFixedHeaders = true;
                ov.FixedHeaderIndicator = FixedHeaderIndicator.None;
            }