PHP code example of emog / phalcon-kendo-grid
1. Go to this page and download the library: Download emog/phalcon-kendo-grid 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' );
emog / phalcon-kendo-grid example snippets
use EmoG \KendoGrid \KendoGrid ;
class TestController extends \Phalcon \Mvc \Controller {
public function indexAction () {
if ($this ->request->isAjax()) {
$builder = $this ->modelsManager->createBuilder()
->columns('id, name, email, balance' )
->from('Example\Models\User' );
$kendoGrid = new KendoGrid();
$kendoGrid->fromBuilder($builder)->sendResponse();
}
}
}
use EmoG \KendoGrid \KendoGrid ;
class TestController extends \Phalcon \Mvc \Controller {
public function indexAction () {
if ($this ->request->isAjax()) {
$resultset = $this ->modelsManager->createQuery("SELECT * FROM \Example\Models\User" )
->execute();
$kendoGrid = new KendoGrid();
$kendoGrid->fromResultSet($resultset)->sendResponse();
}
}
}
use EmoG \KendoGrid \KendoGrid ;
class TestController extends \Phalcon \Mvc \Controller {
public function indexAction () {
if ($this ->request->isAjax()) {
$array = $this ->modelsManager->createQuery("SELECT * FROM \Example\Models\User" )
->execute()->toArray();
$kendoGrid = new KendoGrid();
$kendoGrid->fromArray($array)->sendResponse();
}
}
}
class User extends \Phalcon \Mvc \Model {
}