what is openapi and why should you use it?

What Is OpenAPI And Why Should You Use It?

April 7, 2020
laravel accessors and mutators

Laravel: Accessors And Mutators

May 11, 2020

Datatables With Laravel

April 30, 2020 / Rayne Falkenberg

When creating a web app it usually involves creating a dashboard and a place for the user to see data pertaining to their company. You can create a normal table like below but then you will have to add your own sorting and searching functionalities.

 

Name Surname Account Type
Rayne Logan Admin

 

That is why I like to use Datatables.net they easy to use and have a lot of different add-ons.

Steps on installing the basic Datatables into your Laravel app:

    1. resources/views/layouts/app.blade.php
    2. On your view that you will be displaying the table
      •  
    3. Now you have a Datatable implemented on your site.

 

Note: If you have multiple tables on one view make sure that each of them has a different id and that you have called the function in your script tags for each table.

 

Addons that I use frequently:

  • StateSave:
    • Whenever your user comes back to the page the datatable remembers the state they left it in (eg. what was sorted).
  • File Export:
    • Adds buttons – to print; export as a pdf, csv or excel; and copy – above your table.
  • Regex Search:
    •   I used this to allow my users to search for multiple terms separated by a space or a comma.

 

Happy coding!

Share

Rayne Falkenberg

Rayne is a developer manager with experience in web apps, mobile apps and project management.

✕
Datatables With Laravel
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
Read more