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

CRUD List page is slow when using filters #448

Closed
tiagop93 opened this issue Feb 14, 2017 · 1 comment
Closed

CRUD List page is slow when using filters #448

tiagop93 opened this issue Feb 14, 2017 · 1 comment

Comments

@tiagop93
Copy link

tiagop93 commented Feb 14, 2017

Hello, I've recently implemented filters on my CRUD controller, when I try to load the CRUD list view it slowly loads all the items and the pagination loads the items slowly too.
I searched for the problem and I found an issue about 'Slow perfomance in big tables', saying it could be fixed by implementing $this->crud->enableAjaxTable(); in my Entity Crud Controller. The problem is I already implemented that and it doesn't seem to help.

Here's the filter implementation code:
$this->crud->addFilter([ 'name' => 'country', 'type' => 'select2', 'label' => 'Country' ], function() { return News_Posts::all()->pluck('country', 'country')->toArray(); } , function ($value) { $this->crud->addClause('where', 'country', $value); });

PS: I'm using Laravel version 5.3.30; Backpack-crud version 3.2.3
Any suggestions and tips is highly appreciated!

@tiagop93
Copy link
Author

tiagop93 commented Feb 21, 2017

Ok, found a way to fix it, the problem was in the filter implementation code. I changed from return News_Posts::all()->pluck('country', 'country')->toArray(); to return News_Posts::pluck('country','country')->toArray();

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

No branches or pull requests

1 participant