Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TuffRivers's avatar

Best way to use datatables with laravel 8?

Hi All,

I have a simple laravel 8 MVC app that i have a few tables i want to use datatables for, whats the best way to implement this? Simply with a jquery data tables library? (https://datatables.net/) or using something more laravel-y like (https://github.com/yajra/laravel-datatables) which seems uses jquery datatables anyways.

0 likes
3 replies
atthakasem's avatar

I believe the best way is to use npm and load it in resources/js/app.js: https://www.datatables.net/download/npm

The other package you mentioned seems to be built specifically for server-side rendering of datatables. If you don't plan to use that feature, then you probably won't need it.

1 like
sr57's avatar

There is never absolute "best way".

That said, under the hook yajra datatable uses datatables.net which has 2 modes client or server sides and yajra is only a Laravel interface to server side.

To choose :

https://datatables.net/reference/option/serverSide

Since I have large tables (>50.000 records), I use Yajra .... and even for (very) small tables .... because I'am lazy, don't want to have 2 ways of coding, and everything works very like this ... so it's MY best choice.

1 like
TuffRivers's avatar

ya my tables are going to be small, hundreds of rows MAX, and for ease of use if i can kill two birds with one stone yajra might make sense, i can just render it all server side.

Thanks, that helps peeps

Please or to participate in this conversation.