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

"Clear all filters" on gridMenu wipes out filter conditions #4657

Closed
zjda opened this issue Nov 8, 2015 · 8 comments
Closed

"Clear all filters" on gridMenu wipes out filter conditions #4657

zjda opened this issue Nov 8, 2015 · 8 comments

Comments

@zjda
Copy link

zjda commented Nov 8, 2015

"Clear all filters" on gridMenu wipes out filter conditions as shown in the test:

http://plnkr.co/edit/7O9OkqFHoVmzHx3OiAH2

The conditions are printed to console when typing in a filter field. Can I remove "Clear all filters" on gridMenu (as a workaround)?

@imbalind
Copy link
Contributor

imbalind commented Nov 8, 2015

I don't understand the issue here.
What would you expect "Clear all filters" to do?

@zjda
Copy link
Author

zjda commented Nov 9, 2015

Thank you for looking at my report. I expect "Clear all filters" will clear all search terms for all filters while keeping their conditions intact. Otherwise the behavior of filtering function will be changed after executing "Clear all filters". For example, my test case in the plnkr link has 3 entries:

$scope.data=[{id: '111', name : 'john'}, {id: '112', name : 'joe'}, {id: '211', name : 'jack'}];

and the id column is defined as

{ field: 'id', filter: {condition: uiGridConstants.filter.ENDS_WITH}}

If I type 2 in the filter field, only the second item (id=112) is displayed. After executing the command, however, both the second (id =112) and third (id= 211) items are displayed when I type 2 in the filter. It is because the condition is removed by the command, which is not expected.

@imbalind
Copy link
Contributor

imbalind commented Nov 9, 2015

The problem is in ui-grid-menu-button.js where we call grid.clearAllFilters passing true as the second parameter.

In Grid.js (and in clearAllFilters docs) we can see that the second parameter's meaning is exactly whether to clear conditions or not.

I don't know if that behaviour is the desired logic or maybe an error, but I have to admit I see no point in clearing conditions set by the devs.

If you feel like you can propose a PR to change said behaviour and the team will decide whether to accept it or not.

Sadly I think there is no way to remove that specific menu button when filtering is enabled.

@zjda
Copy link
Author

zjda commented Nov 9, 2015

It will be appreciated if you can tell me where I can submit the PR? Thanks,

@imbalind
Copy link
Contributor

imbalind commented Nov 9, 2015

You can start reading the files:

  • FIRST_TIMER.md
  • CONTRIBUTING.md
  • DEVELOPER.md

You can find them at the root folder of source code.

@zjda
Copy link
Author

zjda commented Nov 10, 2015

I will read the documents and submit the PR. Thank you very much.

@lebolo
Copy link
Contributor

lebolo commented Apr 26, 2016

I've created PR #5361, and all tests pass, but still not sure why the original source cleared conditions or what the intention was.

@ravivantaku
Copy link

Hi,
I need to call a function when i click on "clear all filters" in grid menu, because i need to clear custom filters also when i click on "clear all filters". Can any one help me? how to handle the grid menu clear all filters click event.
Thanks in advance.

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

No branches or pull requests

4 participants