Is there any way to pass along additonal variables with the standards?:
draw:
recordsTotal:
recordsFiltered:
data:
Good question.. Currently there is no way (there is a workaround) to add variables on the standard response. I guess this is a good enhancement that should be implemented. Thanks!
But if you urgently need this. I think a workaround would be catching the response and then manipulate and add the necessary data. A workaround something like below:
$users = User::select(['id', 'name', 'email', 'created_at', 'updated_at']);
$response = Datatables::of($users)->make(true);
$data = $response->getData(true);
$data['key'] = 'value';
return new JsonResponse($data);
I think it would be nice if we could have something like:
$users = User::select(['id', 'name', 'email', 'created_at', 'updated_at']);
return Datatables::of($users)
->with([
'key1' => 'value1',
'key2' => 'value2',
])
->make(true);
Tagging as for enhancement.. Will try to implement this. Thanks!
Great response. Thank you!
Added on upcoming v6.0 release. Thanks!
Is this tagging feature already supported in 6.0? Thanks.
Yes, snippet below is already supported on v6.0.
$users = User::select(['id', 'name', 'email', 'created_at', 'updated_at']);
return Datatables::of($users)
->with([
'key1' => 'value1',
'key2' => 'value2',
])
->make(true);
return Datatables::of($users)
->with([
'key1' => 'value1',
'key2' => 'value2',
])
->make(true);
how i get the value1
How to print in blade ???
Y
Most helpful comment
I think it would be nice if we could have something like:
Tagging as for enhancement.. Will try to implement this. Thanks!