DataGridExtensions icon indicating copy to clipboard operation
DataGridExtensions copied to clipboard

Add 'Filtered' event and 'DataGridFilteredEventArgs'

Open fraluderin opened this issue 1 year ago • 5 comments

I needed to be notified when a filtering on DataGrid was completed. More specifically, I needed to know how many items were found with applied filter. So, this PR adds an event 'Filtered' which occurs after filters are applied. Its argument 'DataGridFilteredEventArgs' contains an IList of matching items found. 'DataGridFilteredEventArgs' could eventually be expanded with additional features.

fraluderin avatar Feb 08 '24 12:02 fraluderin

@dotnet-policy-service agree

fraluderin avatar Feb 08 '24 12:02 fraluderin

@fraluderin There is already an event FilterChanged, which seems to do the same

tom-englert avatar Mar 28 '24 14:03 tom-englert

This will only notify you when the filter condition has changed, not when the filtered data has change. It will not notify you about changes to the data when the data source changes. To achieve this you should rather register to the changes on the items.

tom-englert avatar Apr 01 '24 11:04 tom-englert

I added the Filtered event to get information about items that match applied filter(s). FilterChanged does not inform me about which items match applied filter. E.g., I need to know which items match after user changes applied filters; source data didn't change. Is there a way to know this without adding Filtered event and DataGridFilteredEventArgs?

fraluderin avatar Apr 01 '24 11:04 fraluderin

You are just returning this: https://github.com/dotnet/DataGridExtensions/blob/a8b0e4aee70bbedcd1831b5b28eee3abd9a7ae83/src/DataGridExtensions/DataGridFilterHost.cs#L234

tom-englert avatar Apr 01 '24 15:04 tom-englert

Not required, information already available

tom-englert avatar May 05 '24 10:05 tom-englert