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
1255
Column chooser question
posted

Hello,   we have a column chooser on the grid.  When select columns,  some are mingled in the existing columns making it more difficult for a user to find the newly selected columns
. I wonder how to have new columns selected by user always added to the end of the columns displayed.  Thanks !

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    I'm having a hard time understanding your question.

    It sounds like you are saying that when the user clicks the checkbox on a column in the ColumnChooser, you want that column to always go to the end, instead of appearing where it was previously located.

    If that's what you want, then I think it should be easy to accomplish by handling the BeforeColPosChanged event. Something like this:


            private void ultraGrid1_BeforeColPosChanged(object sender, BeforeColPosChangedEventArgs e)
            {
                if (e.PosChanged == PosChanged.HiddenStateChanged)
                {
                    foreach (Infragistics.Win.UltraWinGrid.ColumnHeader header in e.ColumnHeaders)
                    {
                        if (header.Column.Hidden == false)
                        {
                            header.VisiblePosition = 999;
                        }
                    }
                }
            }

    I used 999 here, because I figure that will always be higher than the VisiblePosition on any of the other columns in the grid. But just to be safe, it might be better to loop through the existing columns in the grid and find the highest VisiblePosition and then add 1 to it. My code seemed to work okay in the brief testing I did, though.

Reply Children