<?php require_once 'lib/Kendo/Autoload.php'; include 'header.php'; // ---- Kendo UI DataSource Transport ---- $read = new Kendo\Data\DataSourceTransportRead(); $read->url('/api/employees.php')->contentType('application/json'); $transport = new Kendo\Data\DataSourceTransport(); $transport->read($read); // ---- Kendo UI Hierarchical DataSource ---- $model = new \Kendo\Data\HierarchicalDataSourceSchemaModel(); $model->id("EmployeeID")->hasChildren("HasEmployees"); $schema = new \Kendo\Data\HierarchicalDataSourceSchema(); $schema->model($model); $dataSource = new \Kendo\Data\HierarchicalDataSource(); $dataSource->transport($transport)->schema($schema); // ---- Kendo UI TreeView ---- $treeview = new \Kendo\UI\TreeView('employee-list'); $treeview->dataSource($dataSource)->dataTextField("FullName"); ?> <h2>Employees</h2> <p> A Kendo UI TreeView control with a hierarchical data source, lazy-loading the employee hierarchy. </p> <?php echo $treeview->render(); ?> <?php
x: 3, y: 3, width: 68, height: 68 })); return g; } </script> <?php $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('index.php')->contentType('application/json')->type('POST'); $transport = new \Kendo\Data\DataSourceTransport(); $transport->read($read); $model = new \Kendo\Data\HierarchicalDataSourceSchemaModel(); $model->children("items"); $schema = new \Kendo\Data\HierarchicalDataSourceSchema(); $schema->model($model); $dataSource = new \Kendo\Data\HierarchicalDataSource(); $dataSource->transport($transport)->schema($schema); $layout = new \Kendo\Dataviz\UI\DiagramLayout(); $layout->type('layered'); $shape_defaults = new \Kendo\Dataviz\UI\DiagramShapeDefaults(); $shape_defaults->visual(new \Kendo\JavaScriptFunction('visualTemplate'))->editable(false)->rotatable(false)->resizable(false); $stroke = new \Kendo\Dataviz\UI\DiagramConnectionDefaultsStroke(); $stroke->color('#979797')->width(2); $connection_defaults = new \Kendo\Dataviz\UI\DiagramConnectionDefaults(); $connection_defaults->stroke($stroke); $diagram = new \Kendo\Dataviz\UI\Diagram('diagram'); $diagram->dataSource($dataSource)->layout($layout)->shapeDefaults($shape_defaults)->connectionDefaults($connection_defaults);
?> <div class="demo-section"> <strong>Inline data (default settings)</strong> <?php $inlineDefault = new \Kendo\Data\HierarchicalDataSource(); $inlineDefault->data(array(array('text' => 'Furniture', 'items' => array(array('text' => 'Tables & Chairs'), array('text' => 'Sofas'), array('text' => 'Occasional Furniture'))), array('text' => 'Decor', 'items' => array(array('text' => 'Bed Linen'), array('text' => 'Curtains & Blinds'), array('text' => 'Carpets'))))); $treeviewLeft = new \Kendo\UI\TreeView('treeview-left'); $treeviewLeft->dataSource($inlineDefault); echo $treeviewLeft->render(); ?> </div> <div class="demo-section"> <strong>Inline data</strong> <?php $model = new \Kendo\Data\HierarchicalDataSourceSchemaModel(); $model->children("subCategories"); $schema = new \Kendo\Data\HierarchicalDataSourceSchema(); $schema->model($model); $inline = new \Kendo\Data\HierarchicalDataSource(); $inline->schema($schema)->data(array(array('categoryName' => 'Storage', 'subCategories' => array(array('subCategoryName' => 'Wall Shelving'), array('subCategoryName' => 'Floor Shelving'), array('subCategoryName' => 'Kids Storage'))), array('categoryName' => 'Lights', 'subCategories' => array(array('subCategoryName' => 'Ceiling'), array('subCategoryName' => 'Table'), array('subCategoryName' => 'Floor'))))); $treeviewRight = new \Kendo\UI\TreeView('treeview-right'); $treeviewRight->dataSource($inline)->dataTextField(array('categoryName', 'subCategoryName')); echo $treeviewRight->render(); ?> </div> <style scoped> #example { text-align: center;