megapixel23 / kendo-yii2-adapter
There is no license information available for the latest version (dev-master) of this package.
Kendo Grid adapter for Yii2
dev-master
2015-12-15 16:49 UTC
Requires
- yiisoft/yii2: >=2.0.2
This package is not auto-updated.
Last update: 2024-12-21 19:37:13 UTC
README
It is a adapter for Yii2 that transforms Kendo Grid`s frontend requests into ActiveQuery on backend. Supports all KendoGrid`s filtering, sorting, searching etc.
Kendo Grid docs
Instalation
- Add following line into
require
section in yourcomposer.json
:
"require": { "megapixel23/kendo-yii2-adapter": "dev-master" }
- If you want to install package directly from GitHub, you need to add following line into
repositories
section in yourcomposer.json
to set up composer`s package source path:
"repositories": [ { "type": "git", "url": "https://github.com/MEGApixel23/kendo-yii2-adapter" } ]
Basic Usage
Frontend
var grid = $("#grid").kendoGrid({ dataSource: { type: 'json', transport: { read: '/custom/action/handler' }, schema: { data: 'data', total: 'total' }, pageSize: 20, serverPaging: true, serverFiltering: true }, filterable: { mode: 'row' }, pageable: true }).data('kendoGrid');
Backend
public function actionCustomActionHandler() { if (Yii::$app->request->isAjax) { Yii::$app->response->format = 'json'; $query = Items::find(); $provider = new KendoDataProvider([ 'query' => $query ]); return [ 'data' => $provider->getModels(), 'total' => $query->count() ]; } }