New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
empty result set yajra datatable on large tables #858
Comments
Have you tried inspecting the ajax request? It should give you an error dump on what's causing the issue. |
@yajra , Yes I did but just an empty response and of course between fetching questions and before calling
I do not know that is a reason for the error or not? |
You are indeed loading all your records which would definitely eat up a lot of your resources. I suggest you remove public function questionsDatatable (Request $request)
{
$questions = Question::with('latest_sub_question')->whereNull('parent');
$datatable = app('datatables')->of($questions)
->addColumn('checkbox', '<input type="checkbox" name="item_id[]" value="{{$question_id}}" id="Check_{{$question_id}}">');
->editColumn('latest_sub_question', function($item) {
return is_null($item->latest_sub_question) ? $item : $item->latest_sub_question;
})
//other column modifications comes here
return $datatable->make(true);
} |
I have a
Question
Model by about 30,000 records like this:To show a list of all questions I'm using yajra datatable laravel package.
This is my js code :
And in the back-end I wrote this function:
First when my table had A few rows all things worked fine but when I added a large number of new records,
questionsDatatable
return empty value and cause datatables return an alert error.what is problem ? and is there any parameter that can use to solve this problem?
The text was updated successfully, but these errors were encountered: