big datatable data

can please give example how can fetch big data table with laravel server fast and smooth...
as i check i didn't find source code example,
can pls help

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (9)

Hi,

Our Laravel Datatable uses the library name yajra/laravel-datatables. By right, fetching big data is supported.

Please check the documentation to create the datatable.
https://preview.keenthemes.com/metronic8/laravel/documentation/general/datatables/overview

For more information about the library, you can check it here.
https://github.com/yajra/laravel-datatables

Thanks

Hi,
Thank for your help,
I try to using your recommend library with laravel but I see still have some loading time
can you pls check my example I created using your library yajra

http://laravel-test.mim4soft.com/public/

I hope you check and feedback with which issue still solved to be very fast loading data

Regards,
M.Fakira

Hi M.Fakira

The datatable handles in client-side and it should be fast. The slowness issue is your backend server (API).

As we can see here, you are using remote pagination. For each API request for 10 records, it takes around 1 second or more.

image

Thanks

Can you please more clarify what is my mistake the be loading slow!
Laravel actually using paginator, so what is can benefit from jquery ajax load, which difference ??

Maybe, I can assist the difference between this and laravel paginate is that you are rendering the data on the server instead of the client. And personally Yajra is a lot better as it has many benefits that laravel paginating simply does not have. You can write very complex code and pass that information into the datatable.

Usually, when you are doing Users::all() that causes a lot of slowness on the page load because the server is trying to run that big of a query. My recommendation would be to only select the columns in the Datatable that you need.

Example:

Users::select('name', 'phone', 'username')

This will drastically reduce the load time of data.

Note:

This is just my personal preference ,but instead of storing the query inside of the controller itself. You can actually make it a scope inside of your model.

Example -

public function scopeDatatable($query)
{
return $query->select('id', 'status', 'tractor_id', 'year', 'make', 'model', 'owned_by', 'last_inspection_date');
}

Hope this helps!

Thanks for your help and replay ,
I try again to reusing the yajra it's working fast
http://laravel-test.mim4soft.com/public/students

The important thing with me how can using this library with complex queries with laravel , for example if I want to get student data from multi table with some special combine conditions query ,

Can pls help how do this with Yajra , can you also give me source link can help!

A lot of Regards, Thanks

Great Eric. Thank you for your big help!

Hi,

In the datatable initialize controller, usually inside app/DataTables. There is a function query(), you can do a more complex query from the Model using Laravel Eloquent.

public function query(Model $model)
{
return $model->newQuery()->with('statuses');
}

Thanks

Hi Sir,

I have some issues need to help
1- Can Yajra working with Laravel 5.2

2-How can combined your theme Metronic 8 with Yajra without lose your theme style and all functionality , Because when I install Yajra in my project the many functionality is lose and not working perfectly ..!

3-Your package theme have laravel folder, so how can I us it , and can I using Laravel from command , but not have idea how install you theme in it.

4-Could you please check my system that is using with your Theme https://tsawadnotjson.mim4soft.com/user/login User & pass : superadmin
I using read data from json and load every time 20 record , so when try search in table it's only search inside the 20 recode only not all data
https://ibb.co/NLn5swg

How you help
Thank you much

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(