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

fix select rows query #632

Merged
merged 1 commit into from
Feb 13, 2022
Merged

fix select rows query #632

merged 1 commit into from
Feb 13, 2022

Conversation

Lupennat
Copy link

@Lupennat Lupennat commented Feb 2, 2022

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests and did you add any new tests needed for your feature?
  2. Did you update all templates (if applicable)?
  3. Did you add the relevant documentation (if applicable)?
  4. Did you test locally to make sure your feature works as intended?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

more info on issue #625

@Lupennat
Copy link
Author

Lupennat commented Feb 8, 2022

@rappasoft any chance to approve this pull request?

@rappasoft rappasoft added the Awaiting Next Release Currently merged into development awaiting a release to master label Feb 13, 2022
@rappasoft rappasoft mentioned this pull request Feb 13, 2022
@rappasoft rappasoft merged commit 4e6c33f into rappasoft:master Feb 13, 2022
@Lupennat Lupennat deleted the feature/fix-select-rows-query branch February 13, 2022 22:30
@affektde
Copy link

affektde commented Mar 4, 2022

I think this introduced a bug, when we use columnSearch filter. (https://rappasoft.com/docs/laravel-livewire-tables/v1/columns/column-header-search)

$this->query() holds already a search query from a possible columnSearch.

The resulting wheres with and or and queries all items with title %lo%" in my example.

selectedRowsQuery then holds the whole page instead of the one selected item.(id:4046 in my example)

image

I'll try to find a solution for that, but maybe someone has a quick fix for it.

@affektde
Copy link

affektde commented Mar 4, 2022

Okay sorry for the noise.

For those who may have the same problem: don't use orWhere in your columnSearch queries.

image

@Lupennat
Copy link
Author

Lupennat commented Mar 4, 2022

Hi @affektde PR, only change behaviour when "select All" Checkbox is enabled. Are you sure the problem is related to the pull request?

@Lupennat
Copy link
Author

Lupennat commented Mar 4, 2022

@affektde you can use where with closure like this:

$query->when($this->columnSearch['title'] ?? null, function($query, $value){
   $query->where(function($query) use($value) {
        $query->where('title', 'like', '%' . $value . '%')
              ->orWhere('version', 'like', '%' . $value . '%');
    });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Next Release Currently merged into development awaiting a release to master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants