
What Is OpenAPI And Why Should You Use It?
April 7, 2020
Laravel: Accessors And Mutators
May 11, 2020
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:
-
- resources/views/layouts/app.blade.php
- On your view that you will be displaying the table
- Now you have a Datatable implemented on your site.
- resources/views/layouts/app.blade.php
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!