question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[New Feature] Add native laravel pagination

See original GitHub issue

I have a table with 1k rows and I want to use native laravel pagination. I don’t know if is posible right now? Something like:

$this->crud->setFromDb()->paginate(15);

Pagination docs: https://laravel.com/docs/5.4/pagination Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jsiebachcommented, Mar 14, 2017

Sure - using the DataTables JS documentation, if you pass along a parameter to the constructor called displayStart, the pagination will start there. So if you want to start with item 100, you could use the URL http://example.dev/admin/model?displayStart=100

Then edit your list.blade.php file like so (3 new lines close to the end):

var table = $("#crudTable").DataTable({
    "pageLength": {{ $crud->getDefaultPageLength() }},

    @if(Request::has('displayStart'))
    "displayStart": {{ Request::get('displayStart') }}
    @endif
....

If you’re showing 10 per page, that will link you straight to page 11.

If you want to use page instead of start index, just multiply it by $crud->getDefaultPageLength()

This works in non-ajax also

0reactions
lloy0076commented, Aug 12, 2017

I believe this issue has run its course.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Database: Pagination - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We've already laid the foundation — freeing you to create without sweating...
Read more >
Laravel Pagination Customizations - GeeksforGeeks
Pagination is a navigation bar that helps users to move from one page to another page. Customize Pagination means styling the navigation bar ......
Read more >
Laravel 9 Pagination: The Complete Guide - AppDividend
To create pagination in Laravel, use the paginate() method on the query builder or an Eloquent query. The paginate() method sets the proper ......
Read more >
Laravel 9 Pagination Example with Bootstrap Tutorial
Implementing pagination in laravel is smooth, add the laravel paginate function in the getData() function inside the EmployeeController class.
Read more >
Laravel 8 Tutorial - Pagination - YouTube
In this video I will talk about Database Pagination.TOPIC DISCUSSED:PaginationFakerSeederControllerYour Queries -1.What is pagination ?2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found