I have faced problem regarding datatables.I am working in laravel and used yajra/laravel-datatables-oracle
package.
In one of my product section, there are 100-200k records. When I hit my product listing, it will take lots of time to load because I am getting all records from the database.
I am trying to get records on the basis of limit but it will create a problem in pagination and searching. Only one pagination link working and all other pages return empty data.
Here below is my server side code:
$skip = $request->get('start') != null ? $request->get('start') : 0;
$take = $request->get('length') != null ? $request->get('length') : 10;
$products = Product::skip($skip)->take($take)->get();
$count = Product::get()->count();
return Datatables::of($products)->setTotalRecords($count)->make(true);
ajax response:
{"draw":2,"recordsTotal":121,"recordsFiltered":121,"data":[],
Here data is empty, I am not sure how to append data while ajax call.
How I code when we have a large amount of records?