-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Added new 'clear'-scope as requested in #3952 #4744
Conversation
Format in config_filter.yaml: ``` clear: label: Clear filters type: clear ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robinbonnes Please review and fix the code style issues reported here:
https://github.com/octobercms/october/pull/4744/checks?check_run_id=291252747#step:6:8
@bennothommo fixed ✔️ |
I think this will be better as option in config_list.yaml something like And question does this resets values to default or totally "clears" filter? |
Thats also an idea, however on this way you can specify where to place the clear filter button in the filter list (start, end) and what the button text should be (the label). Now it does reset all filters to |
@robinbonnes Yeah, it should reset to default because if something cant be null then you get DB errors. |
I'm not sure if this PR is still being worked on, but here goes... The |
Although the PR needs some adjustments... Can we reopen this? |
In my testing, this line only updates the scope container. The content of the backend list, however, remains the same. Removing this line inverts the issue: the list contents are refreshed but the scope container no longer updates. |
In order to circumvent the above issue, we should not abruptly return the partial update before the The following works (and is a bit cleaner):
The @robinbonnes Currently I don't have time to make a PR for this. Would you update your PR with these changes? |
I have also noticed that there is a bug regarding scopes with dropdown options. This PR with the changes I've suggested above clears the actual filters in the session, however, the previously selected dropdown items are still selected in the backend UI. This selection is only applied when filtering the list again though. |
This PR would also benefit from an optional If you don't have time to continue working on this PR @robinbonnes, I could give it a go soon so do let me know. |
One more thing. The
Using |
@msimkunas Thanks for your suggestions, really appreciate it! I've added it to the PR. Some questions:
Ofcourse you are free to work on this PR. |
@robinbonnes The As for the default switch/checkbox value – I believe that the user setting should be respected here and the default (if provided) should be retrieved from the scope configuration. |
Also bear in mind that this PR needs to reset the filter values on the client side in order to be fully functional. This requires one to somehow reinitialize the JS scope widget and IIRC the existing JS widget requires significant changes for this to be possible (i.e. it needs to unbind event handlers and properly dispose of itself upon destruction). Another approach would be to somehow detect partial updates from within the widget and clear the scopes accordingly. |
@LukeTowers The problem, I think, is that it's only one part of the solution. See my comment for more details. |
Doesn't the |
Thanks for this @robinbonnes and your insights @msimkunas This has been merged for the next release in v2.2 |
…/october/issues/3952.
Format in config_filter.yaml: