PHP code example of riesenia / kendo

1. Go to this page and download the library: Download riesenia/kendo 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/ */

    

riesenia / kendo example snippets


use Riesenia\Kendo\Kendo; 

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

use Riesenia\Kendo\Kendo; 

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

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());

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']
    ]);

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") + "!!!");
    }'));