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.
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.
Ok. Thanks for your fast reply.
I applied what you told me to do. It worked.
Here comes a problem with your approach.
When I filter out the keyword "apple" and click HEADERCHECKSTATE, grid items starting with the keyword "apple" will be clicked.
When I erase the filter keyword "apple", all grid items appear, but that is when a problem arises.
The HEADERCHECKSTATE should be intermediate since not itmes are no checked, but it is still in checked status.
Is there any way to corect this behavior of the Grid?
I attached a sample project in order to demonstrate what I mean.