2017 © Pedro Peláez
 

library kendo

PHP wrapper for Kendo UI widgets

image

riesenia/kendo

PHP wrapper for Kendo UI widgets

  • Sunday, July 22, 2018
  • by riesenia
  • Repository
  • 3 Watchers
  • 11 Stars
  • 1,477 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 14 Versions
  • 20 % Grown

The README.md

PHP wrapper for Kendo UI widgets

Build Status Latest Version Total Downloads Software License, (*1)

Kendo UI is a great JavaScript library. It offers both open-source and commercial editions., (*2)

This library provides a wrapper for all Kendo UI widgets. Telerik provides PHP wrappers itself, but these are unnecessarily complex and in addition they are paid. Our library is released under the MIT license, so you are free to use it in any project (even commercial projects) as long as the copyright header is left intact., (*3)

Installation

Install the latest version using composer require riesenia/kendo, (*4)

Or add to your composer.json file as a requirement:, (*5)

{
    "require": {
        "riesenia/kendo": "~3.0"
    }
}

Note: if you use PHP 5.4 - 5.6 use 1.* version of this library., (*6)

Usage

Any widget can be created calling the create method of Kendo class. For example creating a grid with selector "#grid" (resulting in $("#grid").kendoGrid({ ... }) can be achieved by calling:, (*7)

use Riesenia\Kendo\Kendo; 

echo Kendo::create('Grid')->bindTo('#grid');

or by:, (*8)

use Riesenia\Kendo\Kendo; 

echo Kendo::createGrid('#grid');

Setting properties

Any property can be set by calling set method. For adding to properties that are represented by array (or objects), add method can be used. Set method can be also used for batch assignment by passing array as the only parameter. To NOT encode passed data, pass them wrapped by Kendo::js() call. All method calls can be chained. Examples:, (*9)

use Riesenia\Kendo\Kendo; 

$grid = Kendo::createGrid('#grid');

// set any property
$grid->setHeight(100);

// set property, that should not be encoded
$grid->setChange(Kendo::js('function(e) {
    console.log(this.select());
}'));

// set properties by array
$grid->set([
    'height' => 100,
    'change' => Kendo::js('function(e) {
        console.log(this.select());
    }')
]);

// add to property
$grid->addColumns(null, 'Name')
    ->addColumns(null, ['field' => 'Surname', 'encoded' => false]);

// pass DataSource object
$grid->setDataSource(Kendo::createDataSource());

Complex example

Creating code for grid as in this example:, (*10)

use Riesenia\Kendo\Kendo; 

$model = Kendo::createModel()
    ->addField('ProductName', ['type' => 'string'])
    ->addField('UnitPrice', ['type' => 'number'])
    ->addField('UnitsInStock', ['type' => 'number'])
    ->addField('Discontinued', ['type' => 'boolean']);

$dataSource = Kendo::createDataSource()
    ->setData(Kendo::js('products'))
    ->setSchema(['model' => $model])
    ->setPageSize(20);

echo Kendo::createGrid('#grid')
    ->setDataSource($dataSource)
    ->setHeight(550)
    ->setScrollable(true)
    ->setSortable(true)
    ->setFilterable(true)
    ->setPageable(['input' => true, 'numeric' => false])
    ->setColumns([
        'ProductName',
        ['field' => 'UnitPrice', 'title' => 'Unit Price', 'format' => '{0:c}', 'width' => '130px'],
        ['field' => 'UnitsInStock', 'title' => 'Units In Stock', 'width' => '130px'],
        ['field' => 'Discontinued', 'width' => '130px']
    ]);

Observable (MVVM)

Rendering for Kendo observable is slightly different. Predefined variable name is viewModel, but this can be overridden by the method variableName. Example:, (*11)

use Riesenia\Kendo\Kendo; 

echo Kendo::createObservable('#view')
    ->variableName('myMvvm')
    ->setFirstName('John')
    ->setLastName('Doe')
    ->setDisplayGreeting(Kendo::js('function() {
        alert("Hello, " + this.get("firstName") + " " + this.get("lastName") + "!!!");
    }'));

This will output:, (*12)

myMvvm = kendo.observable({
    "firstName": "John",
    "lastName": "Doe",
    "displayGreeting": function () {
        alert("Hello, " + this.get("firstName") + " " + this.get("lastName") + "!!!");
    }
});
kendo.bind($("#view"), myMvvm);

The Versions

22/07 2018

dev-master

9999999-dev

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Tomas Saghy

22/07 2018

v3.0.1

3.0.1.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Tomas Saghy

23/01 2018

v3.0.0

3.0.0.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Tomas Saghy

11/10 2017

v2.0.0

2.0.0.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Tomas Saghy

23/02 2017

v1.4.1

1.4.1.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Tomas Saghy

15/10 2015

v1.4.0

1.4.0.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Tomas Saghy

08/05 2015

v1.3.1

1.3.1.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Tomas Saghy

12/04 2015

v1.3.0

1.3.0.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Tomas Saghy

06/02 2015

v1.2.1

1.2.1.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Tomas Saghy

30/01 2015

1.2.0

1.2.0.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Tomas Saghy

03/01 2015

v1.1.1

1.1.1.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Tomas Saghy

29/12 2014

v1.1.0

1.1.0.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Tomas Saghy

29/12 2014

v1.0.1

1.0.1.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Tomas Saghy

23/12 2014

v1.0.0

1.0.0.0

PHP wrapper for Kendo UI widgets

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Tomas Saghy