0

I'm using Datatables to load data from database. My table has more than 3000 entries which i show on my frontend using datatable. But it take too much time to load data. image showing slow loading of data in datatable

Datatable intialize here:

 $(document).ready(function () {
            $('.schools').DataTable({
                ordering: false,
                responsive: true,
                columnDefs: [
                    {responsivePriority: 1, targets: 0},
                    {responsivePriority: 2, targets: -3},
                ]
            });
        })

Laravel code to bring data from database:

public function show()
    {
        $schools = DB::table('schools')->get();
        return view('admin.school.view', compact('schools'));
    }

1 Answers1

0

Nobody can't read 3000 entries at the same time. Try fetching entries per 30 pieces and insert next and back buttons in order not to load the system with unnecessary data.

Nagmat
  • 373
  • 4
  • 14