emog/phalcon-kendo-grid

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (2.0.0) of this package.

KendoGrid Adapter for Phalcon Framework

2.0.0 2019-04-09 19:16 UTC

This package is auto-updated.

Last update: 2022-08-30 12:22:53 UTC


README

Phalcon Integration with Kendo Grid

About

This is a Phalcon Framework adapter for KendoGrid.

Support

Currently supported

  • QueryBuilder interface
  • ResultSet interface
  • Pagination
  • Filtering
  • Ordering

Installation

Installation via Composer

  • Install a composer
  • Create composer.json file inside your project directory
  • Paste into it
{
    "require": {
        "emog/phalcon-kendo-grid": "1.*"
    }
}
  • Run composer update

Example usage

It uses Phalcon QueryBuilder for pagination in DataTables.

In example we have a stantart MVC application, with database enabled. Don't need to provide a normal bootstrap PHP file, for Phalcon documentation, visit official site.

Controller (using QueryBuilder):

<?php
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();
        }
    }
}

Controller (using ResultSet):

<?php
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();
        }
    }
}

Controller (using Array):

<?php
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();
        }
    }
}

Model:

<?php
/**
* @property integer id
* @property string name
* @property string email
* @property float balance
*/
class User extends \Phalcon\Mvc\Model {
}