Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Is there any way to have a custom filter applied programmatically rather than the UI? #79

Closed
peros550 opened this issue Feb 3, 2022 · 5 comments

Comments

@peros550
Copy link

peros550 commented Feb 3, 2022

Thanks for this nice library.

I would like to add custom filtering in addition to what the user may have selected through the UI.

Is this possible?

@davidegironi
Copy link
Owner

Hello,
It's not possible, but you could set the Filter and Sort string like it's done in the Sample project (look at the 'Filter column "string":'). You can also Save and Restore filters.

@peros550
Copy link
Author

peros550 commented Feb 3, 2022

I need to ask something more. I used the LoadFilterAndSort(string filter, string sorting) to apply some custom filtering in addition to any existing filter applied so far and it worked. However, the datagridview object identified the manual filtering and deactivated all filtering UI. That makes sense, as it wouldn't be able to properly show to the user what filter is being applied.

Then, I called Datagridview.CleanFilterAndSort() in an effort to remove all special filtering and enable again the the UI filtering. The filter was removed, but the UI remained deactivated. Any idea how could I solve this issue?

Many thanks

@davidegironi
Copy link
Owner

This should not happen. I cannot replicate your problem. Download the code from this repository. Run the AdvancedDataGridViewSample project. Do some filtering. Click on Save Current Filter And Sort button, then Clean Filter And Sort. Now recall the filter and sort saved using Filter saved, Sort saved, and Apply button. This should apply the filter, you should filtering blocked as you mention. But if you click again Clean Filter And Sort, the UI should be enabled again and the filter clean. Does it work with the Sample project? If so you can take a look at the code of the sample, to check if something different on your. If does not work... we have to investigate further.

@peros550
Copy link
Author

peros550 commented Feb 3, 2022

The app works, I will check your code and compare it with what I do in my code. Thanks a lot for your help so far.

@peros550
Copy link
Author

peros550 commented Feb 3, 2022

I found the difference in your code with mine. You used CleanFilterAndSort() while I used CleanFilter()
The CleanFilterAndSort reactivates the UI. The CleanFilter does not. For me it's fine. Again many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants