Patel's avatar
Level 1

Laravel Pagination using array and without refreshing page.

Hi, I have been trying to implement laravel pagination with an array and it refreshes the page and I dont want that to happen as I have some form fields and on the click of the button it sends a post request to get the records in an array and I display them on the table. With the default pagination it displays the links but when I click on them it refreshes the page and sets the fields to the default values and I have to click again to get the records which is not good.

I want to know if there's an effective way to handle this.

Also want to add I will a have lot of records in the array and that's the reason I want to implement pagination for performance purposed.

Thanks

0 likes
8 replies
Patel's avatar
Level 1

@SilenceBringer I am using jquery datables, the issue with it is its a bit slow as it will fetch all the records and then applies pagination. IS there a better way to handle this using datatables?

jlrdw's avatar

@Patel Why is it fetching all instead of a paginated amount, i.e., like 20. What is this an API? Is the array necessary?

1 like
SilenceBringer's avatar

@Patel usually api allows to paginate items. Are you sure you can't?

Otherwise (if you have a lot of records) it will be slow anyway

1 like

Please or to participate in this conversation.