Hi,
Is there a way that you can include in the Filter dropdown the colors of the grid? I want it to be only in specific column only. Example I have a Column (col1) and I want to put colors on the data in this column and then i want it to filter it by color by choosing on the Filter dropdown. is there any way for this?
Thanks and Regards;
Jerah
Hello Jerah,
Thank you for contacting Infragistics.
I've attached a sample project that demonstrates how to get the behavior you're looking for. You need to handle the UltraGrid.AfterRowFilterDropDownPopulate and UltraGrid.FilterRow events.
In the AfterRowFilterDropDownPopulate event you need to remove the items from e.ValueList.ValueListItems that correspond to the cell values and add new items that correspond to the colors. For each item you add, set its DataValue to the ARGB value of the color.
In the FilterRow event, compare the ARGB value of the background color of the row being filtered to the CompareValue of the current filter condition. If they match, set e.RowFilteredOut to false. If they don't match, set e.RowFilteredOut to true.
Please let me know if you have any other questions about this.
Hello Dave,
Thanks for the quick response. I just have a problem on FilterRow event it doesnt go in the If condition it always gives me the value of count 0. Well according to the file that you sent me is that all columns have colors but on my condition only 1 specific column has colors.
this is the code that im having a problem
private void Grid_FilterRow(object sender, FilterRowEventArgs e) { if ((sender as UltraGrid).DisplayLayout.Bands[0].ColumnFilters[0].FilterConditions.Count > 0) { var condition = (sender as UltraGrid).DisplayLayout.Bands[0].ColumnFilters[10].FilterConditions[10]; e.RowFilteredOut = e.Row.Appearance.BackColor.ToArgb() != Int32.Parse(condition.CompareValue.ToString()); } }
Thanks