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
125
How to Sync ColumnOrder between UltraGrid and UltraGridColumnChooser
posted
Hi, I have a UltraGrid (Winforms) and I have allowed moving of the columns. This means a user can move the column 3 to position column 2 and so on. The user can also select which columns to see using the UltraGridColumnChooser control. Is there any way that I can persist the column order so that when the user starts the application again then the column order is same as he/she left the last time. OR How can I access the most updated column order? Why does the UltraGridColumnChooser not sync with Grid when I move the columns around? Thanks,
Parents
No Data
Reply
  • 37774
    posted

    You can save and load the layout of the grid through the DisplayLayout.Save (or SaveAsXml) and DisplayLayout.Load (or LoadFromXml) methods; these will take into account the column positions that the user has specified.

    As for the issue with the column order, that seems to be a bug since it's not updated even when the ColumnDisplayOrder is set to SameAsGrid.  You should report this to Developer Support.  A quick hack workaround would be to listen to the grid's AfterColPosChanged event and force the column choose to refresh, i.e.:

     private void ultraGrid1_AfterColPosChanged(object sender, Infragistics.Win.UltraWinGrid.AfterColPosChangedEventArgs e)
    {
        if (e.PosChanged == Infragistics.Win.UltraWinGrid.PosChanged.Moved)
        {
            this.ultraGridColumnChooser1.ResetColumnDisplayOrder();
            this.ultraGridColumnChooser1.ColumnDisplayOrder = Infragistics.Win.UltraWinGrid.ColumnDisplayOrder.SameAsGrid;
        }
    }

    -Matt

Children