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
60
Max Width for Fixed Column Area?
posted

My Issue:

I have a grid with quite a few columns. The users are allowed to pin the columns to both the near and far sides of the grid. The problem with this is that if the user pins enough columns, they can completely obscure their view of any unpinned columns. The horizontal scrollbar still appears, but the scrolling columns (aka the unpinned columns) are completely "covered" by the pinned columns.

My Question:

Is there a way to set a maximum width on the amount of space the fixed columns can take up? And if not, do you have a suggestion for a work around? 

For reference, I have included a very simple project that can easily reproduce the issue.

Thanks!

FixedColumnsTest.zip
Parents
No Data
Reply
  • 2677
    posted

    Hello,

    Sorry, but there is no max fields fixed property or max width.  It is just a splitter control inside of the grid.  However, I do have a workaround for you.  You can see how many are fixed and allow or disallow the user to fix more. 

    In the sample code below, I handled the FieldPositionChanging event so I can cancel it if need be.  I have a counter that keeps track of my fields that I have fixed.  I then take a look at the reason the position of the field is changing.  If it is fixing or unfixing, I do the appropriate action to update the counter or cancel the event.  There is also a property that indicates how many fields I can fix.  You can update this based on the width of the grid and the default width of fields.

    //counter for fixed fields
            public int FixedFieldCount = 0;
            public int NumOfFixedFieldsAllowed = 4;
            private void myGrid_FieldPositionChanging(object sender, Infragistics.Windows.DataPresenter.Events.FieldPositionChangingEventArgs e)
            {
                //check to see if we are fixing a field.
                if (e.ChangeReason == Infragistics.Windows.DataPresenter.FieldPositionChangeReason.Fixed)
                {
                    //if there are less then 4 fixed fields, let the field be fixed and update the counter.
                    if (FixedFieldCount < NumOfFixedFieldsAllowed)
                    {
                        FixedFieldCount++;
                    }
                        //if the field is not already fixed , cancel the event so we dont add any more fixed fields
                        //if the field is already fixed and we are fixing on the other side, let it go.
                    else if (!e.Field.IsFixed)
                        e.Cancel = true;

                   
                }
                //if we are unfixing, subtract one from the counter
                else if (e.ChangeReason == Infragistics.Windows.DataPresenter.FieldPositionChangeReason.Unfixed)
                {
                    FixedFieldCount--;
                }
            }

    I hope this helps.  Let me know if this will work for you.

    Also, if you want to see some functionality for this like a MaxFixedFields property like there is for the records, please submit a Feature Request for this functionality.

Children
No Data