I am using xamdatagrid v18.2.
I have a grid that contains hierarchical data. A sample grid is below:
Now here are some examples of what I am looking to achieve. When I set a value in the top level filter any any row satisfies the filter criteria I want the entire order to remain visible.
Filter OrderCategory="Cat1":
7
Filter Size="small":
Filter Quantity="7":
Note that even if one child row at any level matches the filter, the entire order is visible.
Can you please provide a sample solution for this?
Thanks.
Hello TK,
I have been investigating into your requirement in this case, and from the layout of your grid, I have to wonder if you should really be using the XamTreeGrid in this case instead of the XamDataGrid? From your diagram, it looks like you are basically using a single FieldLayout for all of your records, and if so, I would recommend using the XamTreeGrid as this may allow you to achieve your requirement more easily.
With the above said, the closest filter option that we have to what you are describing in this case is if you set the XamTreeGrid.FieldLayoutSettings.FilterAction property to “ReduceOpacity.” This will reduce the opacity on any records that do not satisfy the filter that you have typed, but it will still keep them visible to the user. The issue with this with your requirement is that if an order does not at all satisfy the filter requirement, it will not be filtered out – it will just have all of its record’s opacities changed.
I am attaching a sample project that demonstrates a layout like the one you have diagrammed in this thread using the XamTreeGrid with a FilterAction of “ReduceOpacity.”
If you are looking for the ability to have your filters do exactly what you had described, the best thing I can recommend is to filter your grid manually. You can do this by setting the FilterAction to “None” or “DoNothing” and then handle the RecordFilterChanged event on the grid. Using the event arguments of the RecordFilterChanged event, you can obtain the filter that is applied and run some logic against your underlying data source to add or remove records from the grid.
Please let me know if you have any other questions or concerns on this matter.
XDGHierarchicalFilteringDemo.zip