-
-
Notifications
You must be signed in to change notification settings - Fork 859
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
Access to all returned data of dataTable query on server #1752
Comments
I have found a trivial solution. |
There is a less documented api that you can use to get the filtered query. See https://github.com/yajra/laravel-datatables/blob/8.0/CHANGELOG.md#added and #1068 for ref. $dataTable = Datatables::of(App\User::query());
$response = $dataTable->toJson();
$total = $dataTable-> getFilteredQuery()->sum('total');
// TODO: append queried total to JsonResponse.
return $response; |
Thanks a lot. |
Use filteredQuery as callback parameter. Fix #1752
* 8.0: Bump v8.6.1 🚀 Fix CS. Fix with closue value implementation. Use filteredQuery as callback parameter. Fix #1752
Summary of problem or feature request
First, thanks for this awesome package.
I want to calculate the sum of one columns of filtered data on my dataTable and send it to the client as an extra parameters. To make it more clear, assume that the selected column is price of an item and the extra parameter is the summation of price of all available items that is changed based on the requested search parameters.
As mentioned in dataTable docs, we can pass more extra parameters by the "with" method to the client. My problem is that how we can access all data on server.
Also note that this task can not be done in client-side because for a specific search parameters, only a portion of data are returned to the client based on the predefined pagination and the extra parameter (in my case "total price") is fixed for these search parameters.
Thanks.
System details
The text was updated successfully, but these errors were encountered: