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
130
HeaderCheck Box Isseu with Filtering
posted

I have a grid that consists of apple0, apple 3, apple 6, apple 9, banana1, banana 4, banana 7, oranage2, orange5, oragne8.


Here is what I want.

When I filter my grid with a keyword "Apple", I will see apple0, apple3, apple6, and apple 9.

When I click the headercheck box (unchekced) and click it again (checked), I only exepct to check apple0, apple3, apple6, and apple 9.

However, when I erase the filter keyword, all items are checked. Is there any way that the headercheck box only works for the filtered rows?


I have attached a sample project for you to look at.

Thanks in advance.

WindowsFormsApplication1.zip
Parents
No Data
Reply
  • 21795
    Offline posted

    Hello Jeong,

    Thank you for posting in our forum.

    Right now UltraGrid does not supports synchronization of header check box with filtered rows check boxes. However you may implement this. To do so first set the CheckBoxSynchronization property of your check box header to None. Then in AfterHeaderCheckStateChanged event handler set the cells’ value on each not filtered out row to be equal to the value of header check box. You may use code like this:

    private void UltraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)

            {

                foreach (UltraGridRow row in e.Rows)

                {

                    if (!row.IsFilteredOut)

                    {

                        row.Cells[e.Column.Header.Caption].Value = e.Column.GetHeaderCheckedState(e.Rows);

                    }

                }

            }

    In the attached sample project I have implemented this approach. Please check my sample and let me know if you have any additional questions.

    Thank you for using Infragistics Controls.

    CAS-163788-R4C7M4.zip
Children