davidegironi / advanceddatagridview

A .NET WinForms DataGridView with advanced capabilities
392 stars 123 forks source link

Locked header column menustrips #59

Closed miguelmpn closed 3 years ago

miguelmpn commented 3 years ago

If I programmatically set a filter on my tables

dgRegisters.LoadFilterAndSort("([IsVisible] = True)", "");

The datagrid header menus become locked. How can I programmatically filter with the same behavior of when filtering in the UI which does not block the column filters?

The idea is that I set a filter for the IsVisible column so that the table only shows the visible Rows, then I hide the column and the user can use the remaining filters.

locked datagrid

davidegironi commented 3 years ago

Hello @miguelmpn, this is because the library does not save the full state of the columns filter and sorting. Restoring the state from the FilterString and SortString is a mess, the way to solve this is change the way MenuStrip works, saving the full columns state. That will be a good thing to build. I'm thinking about rewriting the MenuStrip logic due to this issue on performance (https://github.com/davidegironi/advanceddatagridview/issues/58), possibily I'll add a pragmatic Filter and Sort too, but not now. At present I do not have time. Sorry about that.

miguelmpn commented 3 years ago

No problem, I implemented this in the same way as you did in the sample. Good that you had it 👍 Just using the TriggerFilterStringChanged(); and editing the filter in the event.