Data list's toggle all button now selects maximum possible entries #6816
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #4246.
In the first PR, Duncan hid the toggle all button completely if max. selections was only 1. This PR addresses the issue further to handle values larger than 1.
This change will select maximum amount of possible entries, while respecting max. items value. If none is provided, it will toggle all items in the data list page.
As a side mission I was checking out where else this button is utilized, to cover my bases. I found out that
uncheckAllItems
was being used inHasFilters
mixin, which depended on component reference toToggleAll
. When the filters change, the selections are suppose to be cleared. However this reference did not work anymore as the reference was now one level deeper from whereHasFilters
mixin was being used. I updated this mixin to point to a newly addedDataList
component reference, which conveniently already had aclearSelections
method for clearing selections.I am not sure if selection clearing when changing filters is relevant anymore, as the changes that broke this are before my times, before I discovered Statamic. Feel free to disregard by removing
ref="dataList"
. I noticed that relationship item selectorresources/js/components/inputs/relationship/Selector.vue
does not have selection clearing , despite using the sameHasFilters
mixin. I would update it, but this is outside of the scope of this issue and I don't know if it's even an issue yet.And I removed
allItemsChecked
because as far as I could tell it wasn't being used anymore.