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

Bugfix checkboxes behavior when search or filters are active #522

Merged

Conversation

renardudezert
Copy link
Contributor

If the search or filter is active, we must display the count of checked rows only for "visible" items (results of search or filtered results). Therefore, the toggleSelectAll() method must also check or uncheck all "visible" items when the search or filters are active.
See the gif below in order to view the correct behavior (what this PR brings)
bugfix-checkboxes-beahavior-livewire-datatables

- If the search or filter is active, we must display the count of checked rows only for "visible" items (results of search or filtered results). Therefore, the toggleSelectAll() method must also check or uncheck all "visible" items when the search or filters are active.
@@ -1620,14 +1635,38 @@ public function checkboxQuery()

public function toggleSelectAll()
{
if (count($this->selected) === $this->getQuery()->getCountForPagination()) {
$this->selected = [];
$visible_chekboxes = $this->getQuery()->get()->pluck('checkbox_attribute')->toArray();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: please call this variable $visible_checkboxes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just corrected it. You've a good eagle eye 😄

@thyseus
Copy link
Collaborator

thyseus commented Nov 17, 2022

@renardudezert thanks a lot for your work, will merge once you fixed that minor typo !

@renardudezert
Copy link
Contributor Author

You're welcome. It is a good project, the contributions are deserved.

@thyseus thyseus merged commit f140158 into MedicOneSystems:master Nov 27, 2022
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

Successfully merging this pull request may close these issues.

2 participants