laravel / nova-issues

554 stars 34 forks source link

Per Page pagination filter not working #1514

Closed emilianotisato closed 5 years ago

emilianotisato commented 5 years ago

Description:

When you have more than 25 resource items, and you change from the select (image attached) to 50 or 100 per page, no error is throw in the javascript console, the url in the browser do change to my_resource_per_page=100 but the index remains with 25...

Steps To Reproduce:

1) Have more than 25 resource seeded in your db 2) go to the index of that resource 3) change the amount of "per page" items to 50 or 100

Extra info

I am in a fresh install with no extra nova components, no filter package added...

Screenshot from 2019-04-11 17-38-27

emilianotisato commented 5 years ago

I found that in the /nova/src/Http/Requests/ResourceIndexRequest.php, the perPage property is always returning 25... in case is of any help

SerjoA commented 5 years ago

i have the same issue, also no additional filters added

dkulyk commented 5 years ago

This has been fixed and will be included in the next release.

davidhemphill commented 5 years ago

I had to revert the merged PR as it introduced an infinite loop of refreshes on detail views.

I however, was not able to reproduce the original issue with the information you provided. The amount of items in the display is updated correctly when I use the perPage filter.

emilianotisato commented 5 years ago

@dkulyk Can you tell me in witch file/s was the problem so at least I can do a local fix?

@davidhemphill Thanks, I do not understand, I did again a totally fresh install and just seeded 100 users, and I keep not seeing all he records in the display. Maybe is browser related?? I am using chrome 73.0.3683.103

dkulyk commented 5 years ago

@emilianotisato https://github.com/laravel/nova/pull/391/commits/eb7efdbfd17e9e8db5970ea7a0e4235531569c63 It will be fixed if you will remove this.initializePerPageFromQueryString() in this places.

But it's not final fix.

sam-g-roberts commented 5 years ago

I'm getting this error as well with the same version of laravel and nova.

Custom filters and the trashed filter works but the per page filter does not change the number of pages returned

emilianotisato commented 5 years ago

@dkulyk, @davidhemphill
In case is of any use...

I find that it works with nova 2.0.0, but it breaks after (including) nova 2.0.1

So I am looking at the differences, and in nova 2.0.1 you update the package.json changing the version of laravel-nova dependency from 1.0.6 to 1.0.7

When I went and see the changes in the version 1.0.7 in did there is a pull request for the perPage feature: https://github.com/laravel/nova-js/pull/8

Maybe there is the error?

UPDATE (POSIBLE SOLUTION FOUND): In did, for me the solution was just this:

I found that just removing the currentPerPage() method in the Index.vue view (/nova/resources/js/views/Index.vue) the per page start working again because now uses the method from the mixin modified in version 1.0.7 of laravel-nova js library: https://github.com/laravel/nova-js/pull/8/files

sam-g-roberts commented 5 years ago

Can confirm this is still an issue within laravel nova 2.0.3

emilianotisato commented 5 years ago

@sam-g-roberts Yes, I did try it in 2.0.3 and is still an issue. I fix it in my local installation removing the currentPerPage() method as I mention before.

turzaizsolt commented 5 years ago

@emilianotisato I tried your temporary fix and it works for the main index list but has a very strange behaviour on the lens pages. Dose it work for you on lens pages?

emilianotisato commented 5 years ago

@turzaizsolt I did not use Lens in my project. For sure is some similar function in the Lens.vue file...

Can you describe a litle better what you mean by "strange behaviour"? It is something new or is the perPage not working???

turzaizsolt commented 5 years ago

@emilianotisato Strange behaviour as when I open a lens page and change the per page value the pagination links (next and previous) became inactive.

rvanbaalen commented 5 years ago

I updated to 2.0.5 just now and the pagination still doesn't do anything. It's stuck on 25 records per page.

adronitis commented 5 years ago

I have the same issue still with the latest version of Nova and running Laravel 5.8. Not sure why this issue is closed?

loekwetzels commented 5 years ago

I've had this issue since nova 2.0.1 but it has been fixed for me in 2.0.5. Did you guys do php artisan nova:publish as the docs say?

rvanbaalen commented 5 years ago

Confirmed what @loekwetzels just posted. Apparently I forgot to execute php artisan nova:publish.

After running the command, the pagination issue has been resolved! 🎉

aliwesome commented 3 years ago

Can confirm this is still an issue within laravel nova 2.31.1

crynobone commented 3 years ago

We no longer provide bug fixes to Laravel Nova 2.x, please upgrade Laravel Nova 3 as soon as possible.

aliwesome commented 3 years ago

@crynobone I made a mistake mentioning the version. I meant v3.21.0

crynobone commented 3 years ago

Then please create a new issue with complete description based on your usage and reproducing code if possible.

We doesn't reopen 2 years old issue as many things has already changed.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.