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

[Bug] Specifying columns in setupListOperation breaks search unless searchLogic is explicitly set #5251

Closed
colincameron opened this issue Aug 1, 2023 · 4 comments
Labels

Comments

@colincameron
Copy link

Bug report

What I did

When setting up my CRUDs, I found they aren't searchable - typing in the search field just returns all entries.

As a minimal example:

With a fresh installation, run php artisan backpack:crud user - the columns are set from DB and search works as expected.

Change setupListOperation() to contain the single line:

CRUD::column('email')->type('string');

What I expected to happen

The table shows just email addresses for all users, and typing in the search field will filter this list by email.

What happened

No matter what I type, all entries are shown.

What I've already tried to fix it

Explicitly specifying searchType fixes this, and the search works as expected.

CRUD::column('email')->type('string')->searchLogic('text');

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?

Yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 8.2.5 (cli) (built: Apr 13 2023 18:27:51) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.5, Copyright (c) Zend Technologies
with Zend OPcache v8.2.5, Copyright (c), by Zend Technologies

LARAVEL VERSION:

10.13.5.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.0.2
backpack/crud: 6.1.2
backpack/generators: v4.0.2
backpack/pro: 2.0.9
backpack/theme-tabler: 1.0.6

@welcome
Copy link

welcome bot commented Aug 1, 2023

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (How do I do X) - Gitter Chatroom;
  • Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

@pxpm
Copy link
Contributor

pxpm commented Aug 1, 2023

Hey there @colincameron

We don't have any column type => 'string'. That's why the searchLogic is not being applied. (we don't know that column type).

Change it to text, and the text searchLogic would apply.

I don't think there is any bug here. Please re-open if I am wrong.

Cheers

@pxpm pxpm closed this as completed Aug 1, 2023
@colincameron
Copy link
Author

Thanks. That's embarrassing, I've no idea how I got the wrong column type sorry.

@pxpm
Copy link
Contributor

pxpm commented Aug 2, 2023

Thanks. That's embarrassing, I've no idea how I got the wrong column type sorry.

No issues. I've done worst things than that. It happens. 🙃

Let us know if we can help you with something else 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants