protonemedia / inertiajs-tables-laravel-query-builder

Inertia.js Tables for Laravel Query Builder
https://protone.media/en/blog/introducing-inertiajs-tables-a-datatables-like-package-for-laravel-query-builder
MIT License
438 stars 127 forks source link

Possible Bug with "Per Page" filter #83

Open xrayin opened 2 years ago

xrayin commented 2 years ago

Dear Devs,

First off thank you very much for this package, it has been fun learning to implement this. I am relatively new with VUE.

I successfully implemented your package, with Vite.

Everything works so far, and I am using version: ^2.1.0

Only thing that I have encountered so far that I haven't been able to solve and I think might be a bug is the "Per Page" filter left below. When you select other default options such as 30, 50 or 100, it won't show that many items per page. It always remains on 15.

When you use function ->perPageOptions([]) in the controller then the per page 15 default option still remains, even though you have given an empty array.

Thank you and apologies if this happens to be incorrect.

offtopic: is there an default option to keep the default CSS but implement your own table, head and body structure?

heymerridew commented 2 years ago

Hi, I hope this can help you 🙂 Just place request(perPage) in the paginate option.

$users = QueryBuilder::for(User::class) ->defaultSort('name') ->allowedSorts(['name', 'email', 'language_code']) ->allowedFilters(['name', 'email', 'language_code', $globalSearch]) ->paginate(request('perPage')) ->withQueryString();

xrayin commented 2 years ago

@heymerridew Thank you for the solution.

mbeckerle-xqueue commented 1 year ago

Please mark as closed