PHP code example of elnelsonperez / kendo-grid-parser
1. Go to this page and download the library: Download elnelsonperez/kendo-grid-parser library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
elnelsonperez / kendo-grid-parser example snippets
public function list(Request $request, KendoGridService $service)
{
$valid = $this->validate($request, [
'skip' => 'numeric|nullable',
'take' => 'numeric|nullable',
'sort' => 'array|nullable',
'filter' => 'array|nullable'
]);
// Base query. It's convenient to wrap the inner query before applying any grid filters
$query = DB::query()->fromSub(
User::selectRaw('users.id user_id, users.name, addresses.address')
->leftJoin('addresses', 'addresses.user_id', '=','users.id'), 'T'
);
$result_query = $service->execute(
// Grid State
$valid,
// Grid columns and types (string, number, date, or boolean)
[
'user_id' => 'number',
'name' => 'string',
'address' => 'string',
],
// The query builder instance to apply the filters to.
// The service detects the query builder instance class and chooses which adapter to use to build the resulting
// query builder based on the packages configuration
$query
);
return response([
'data' => $result_query->get(),
'total' => $result_query->count()
]);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.