<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Orders', array('OrderID', 'CustomerID', 'ShipName', 'ShipAddress', 'ShipCity', 'ShipCountry'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('virtualization-remote-data-binding.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(100)->schema($schema)->serverSorting(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $orderID = new \Kendo\UI\GridColumn(); $orderID->field('OrderID')->width(60)->title('Order ID'); $customerID = new \Kendo\UI\GridColumn(); $customerID->field('CustomerID')->width(90)->title('Customer ID'); $shipName = new \Kendo\UI\GridColumn(); $shipName->field('ShipName')->width(220)->title('Ship Name'); $shipAddress = new \Kendo\UI\GridColumn(); $shipAddress->field('ShipAddress')->width(380)->title('Ship Address');
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Orders', array('ShipName', 'Freight' => array('type' => 'number'), 'OrderDate', 'OrderID', 'ShipCity'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('remote-data-binding.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $shipNameField = new \Kendo\Data\DataSourceSchemaModelField('ShipName'); $shipNameField->type('string'); $shipCityField = new \Kendo\Data\DataSourceSchemaModelField('ShipCity'); $shipCityField->type('string'); $orderIDField = new \Kendo\Data\DataSourceSchemaModelField('OrderID'); $orderIDField->type('number'); $freightField = new \Kendo\Data\DataSourceSchemaModelField('Freight'); $freightField->type('number'); $orderDateField = new \Kendo\Data\DataSourceSchemaModelField('OrderDate'); $orderDateField->type('date'); $model->addField($shipNameField)->addField($freightField)->addField($orderIDField)->addField($shipCityField)->addField($orderDateField); $schema = new \Kendo\Data\DataSourceSchema();
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Products', array('ProductName', 'UnitPrice', 'UnitsInStock', 'Discontinued'), $request), JSON_NUMERIC_CHECK); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('rtl.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $productNameField = new \Kendo\Data\DataSourceSchemaModelField('ProductName'); $productNameField->type('string'); $unitPriceField = new \Kendo\Data\DataSourceSchemaModelField('UnitPrice'); $unitPriceField->type('number'); $unitsInStockField = new \Kendo\Data\DataSourceSchemaModelField('UnitsInStock'); $unitsInStockField->type('number'); $discontinuedField = new \Kendo\Data\DataSourceSchemaModelField('Discontinued'); $discontinuedField->type('boolean'); $model->addField($productNameField)->addField($unitPriceField)->addField($discontinuedField)->addField($unitsInStockField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->errors('errors')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource();
<?php include '_crud.php'; $table = "Suppliers s"; $columns = array('s.SupplierID', 's.CompanyName as SupplierName'); header('Content-Type: application/json'); $result = new DataSourceResult($database); $data = $result->read($table, $columns); echo json_encode($data['data']);
public function read($table, $properties, $request = null) { $properties = array_merge($properties, array('Title', 'strftime(\'%Y-%m-%dT%H:%M:%SZ\', Start) as Start', 'strftime(\'%Y-%m-%dT%H:%M:%SZ\', End) as End', 'IsAllDay', 'StartTimezone', 'EndTimezone', 'Description', 'RecurrenceID', 'RecurrenceRule', 'RecurrenceException')); return parent::read($table, $properties, $request); }
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; require_once '../include/header.php'; $result = new DataSourceResult('sqlite:..//sample.db'); $data = $result->read('Products', array('ProductName', 'UnitPrice', 'UnitsInStock', 'Discontinued')); $model = new \Kendo\Data\DataSourceSchemaModel(); $productNameField = new \Kendo\Data\DataSourceSchemaModelField('ProductName'); $productNameField->type('string'); $unitPriceField = new \Kendo\Data\DataSourceSchemaModelField('UnitPrice'); $unitPriceField->type('number'); $unitsInStockField = new \Kendo\Data\DataSourceSchemaModelField('UnitsInStock'); $unitsInStockField->type('number'); $discontinuedField = new \Kendo\Data\DataSourceSchemaModelField('Discontinued'); $discontinuedField->type('boolean'); $model->addField($productNameField)->addField($unitPriceField)->addField($unitsInStockField)->addField($discontinuedField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->data($data)->pageSize(16)->schema($schema); $grid = new \Kendo\UI\Grid('grid'); $productName = new \Kendo\UI\GridColumn(); $productName->field('ProductName')->title('Product Name'); $unitPrice = new \Kendo\UI\GridColumn(); $unitPrice->field('UnitPrice')->width('130px')->format('{0:c}')->title('Unit Price'); $unitsInStock = new \Kendo\UI\GridColumn(); $unitsInStock->field('UnitsInStock')->width('130px')->title('Units In Stock'); $discontinued = new \Kendo\UI\GridColumn(); $discontinued->field('Discontinued')->width('130px'); $grid->addColumn($productName)->addColumn($unitPrice)->addColumn($unitsInStock)->addColumn($discontinued)->scrollable(false)->dataSource($dataSource);
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Orders', array('ShipCountry', 'Freight', 'OrderDate'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('selection.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $shipCountryField = new \Kendo\Data\DataSourceSchemaModelField('ShipCountry'); $shipCountryField->type('string'); $frieghtField = new \Kendo\Data\DataSourceSchemaModelField('Frieght'); $frieghtField->type('number'); $orderDateField = new \Kendo\Data\DataSourceSchemaModelField('OrderDate'); $orderDateField->type('date'); $model->addField($shipCountryField)->addField($frieghtField)->addField($orderDateField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(5)->serverPaging(true)->serverSorting(true)->schema($schema); $shipCountry = new \Kendo\UI\GridColumn();
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Employees', array('EmployeeID', 'FirstName', 'LastName', 'City', 'Title', 'Address'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('custom-command.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(10)->schema($schema)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $firstName = new \Kendo\UI\GridColumn(); $firstName->field('FirstName')->title('First Name'); $lastName = new \Kendo\UI\GridColumn(); $lastName->field('LastName')->title('Last Name'); $title = new \Kendo\UI\GridColumn(); $title->field('Title'); $command = new \Kendo\UI\GridColumnCommandItem();
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Customers', array('ContactName', 'ContactTitle', 'CompanyName', 'Country'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('index.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $contactNameField = new \Kendo\Data\DataSourceSchemaModelField('ContactName'); $contactNameField->type('string'); $contactTitleField = new \Kendo\Data\DataSourceSchemaModelField('ContactTitle'); $contactTitleField->type('string'); $companyNameField = new \Kendo\Data\DataSourceSchemaModelField('CompanyName'); $companyNameField->type('string'); $countryField = new \Kendo\Data\DataSourceSchemaModelField('Country'); $countryField->type('string'); $model->addField($contactNameField)->addField($contactTitleField)->addField($companyNameField)->addField($countryField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->errors('errors')->groups('groups')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource();
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); if (array_key_exists('details', $_GET)) { echo json_encode($result->read('Orders', array('OrderID', 'ShipCountry', 'ShipAddress', 'ShipName', 'EmployeeID'), $request)); } else { echo json_encode($result->read('Employees', array('EmployeeID', 'FirstName', 'LastName', 'Country', 'City', 'Title'), $request)); } exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('hierarchy.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(6)->schema($schema)->serverSorting(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $firstName = new \Kendo\UI\GridColumn(); $firstName->field('FirstName')->width(110)->title('First Name'); $lastName = new \Kendo\UI\GridColumn();
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Employees', array('FirstName', 'LastName', 'City', 'Address', 'HomePhone'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('navigation.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->groups('groups')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $group = new \Kendo\Data\DataSourceGroupItem(); $group->field('City'); $dataSource->transport($transport)->pageSize(5)->addGroupItem($group)->schema($schema)->serverSorting(true)->serverFiltering(true)->serverGrouping(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $firstName = new \Kendo\UI\GridColumn(); $firstName->field("FirstName")->title('First Name'); $lastName = new \Kendo\UI\GridColumn(); $lastName->field("LastName")->title('Last Name'); $city = new \Kendo\UI\GridColumn(); $city->field('City');
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Products', array('ProductID', 'ProductName', 'UnitPrice', 'UnitsInStock'), $request)); exit; } require_once '../include/header.php'; ?> <script type="text/x-kendo-tmpl" id="template"> <div class="product"> <img src="../content/web/foods/#:ProductID#.jpg" alt="#:ProductName# image" /> <h3>#:ProductName#</h3> </div> </script> <div class="demo-section"> <?php $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('selection.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $productNameField = new \Kendo\Data\DataSourceSchemaModelField('ProductName'); $productNameField->type('string');
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); if (array_key_exists('details', $_GET)) { echo json_encode($result->read('Employees', array('DISTINCT(' . $_GET['details'] . ')'), $request)); } else { echo json_encode($result->read('Employees', array('FirstName', 'LastName', 'City', 'Title'), $request)); } exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('filter-menu-customization.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(15)->schema($schema)->serverSorting(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $name = new \Kendo\UI\GridColumn(); $name->template("#=FirstName# #=LastName#")->filterable(false)->title('Name'); $cityFilterable = new \Kendo\UI\GridColumnFilterable();
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Products', array('ProductID', 'ProductName'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('remotedatasource.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->schema($schema); $dropDownList = new \Kendo\UI\DropDownList('products'); $dropDownList->dataSource($dataSource)->dataTextField('ProductName')->dataValueField('ProductID')->attr('style', 'width: 250px'); ?> <div class="demo-section"> <h2>Products</h2> <?php echo $dropDownList->render(); ?> </div>
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); if (array_key_exists('type', $_GET)) { echo json_encode($result->read('Categories', array('CategoryID', 'CategoryName'), $request)); } else { echo json_encode($result->read('Products', array('ProductID', 'ProductName', 'UnitPrice', 'QuantityPerUnit', 'CategoryID'), $request)); } exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('toolbar-template.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(20)->schema($schema)->serverSorting(true)->serverFiltering(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $productID = new \Kendo\UI\GridColumn(); $productID->field('ProductID')->width(100)->title('Product ID'); $productName = new \Kendo\UI\GridColumn();
<?php require_once '../lib/Kendo/Autoload.php'; require_once '../lib/DataSourceResult.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Customers', array('ContactName', 'CustomerID', 'CompanyName'))); exit; } require_once '../include/header.php'; $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('template.php')->type('POST'); $transport = new \Kendo\Data\DataSourceTransport(); $transport->read($read); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->schema($schema); $autoComplete = new \Kendo\UI\AutoComplete('customers'); $autoComplete->minLength(1)->dataTextField('ContactName')->dataSource($dataSource)->height(370)->attr('style', 'width:400px')->headerTemplate(<<<TEMPLATE <div class="dropdown-header"><span class="k-widget k-header">Photo</span><span class="k-widget k-header">Contact info</span></div> TEMPLATE )->template(<<<TEMPLATE <span class="k-state-default"><img src="../content/web/Customers/#= CustomerID #.jpg" alt="#= CustomerID #" /></span><span class="k-state-default"><h3>#: data.ContactName #</h3><p>#: data.CompanyName #</p></span> TEMPLATE ); ?> <div class="demo-section"> <h2>Customers</h2>
<?php require_once '../lib/DataSourceResult.php'; require_once '../lib/Kendo/Autoload.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult('sqlite:..//sample.db'); echo json_encode($result->read('Orders', array('OrderID', 'ShipCountry', 'ShipAddress', 'ShipName', 'EmployeeID'), $request)); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('column-menu.php')->contentType('application/json')->type('POST'); $transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $orderIDField = new \Kendo\Data\DataSourceSchemaModelField('OrderID'); $orderIDField->type('number'); $shipNameField = new \Kendo\Data\DataSourceSchemaModelField('ShipName'); $shipNameField->type('string'); $shipAddressField = new \Kendo\Data\DataSourceSchemaModelField('ShipAddress'); $shipAddressField->type('string'); $shipCountryField = new \Kendo\Data\DataSourceSchemaModelField('ShipCountry'); $shipCountryField->type('string'); $model->addField($orderIDField)->addField($shipNameField)->addField($shipAddressField)->addField($shipCountryField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource();
<?php require_once '_crud.php'; header('Content-Type: application/json'); $request = json_decode(file_get_contents('php://input')); $result = new DataSourceResult($database); $data = $result->read($table, $read_columns, $request); // build child objects for category and supplier by converting // the flat data into a child object, for both foreach ($data['data'] as $key => $product) { $supplier = createSupplier($product['SupplierID'], $product['SupplierName']); $product['Supplier'] = $supplier; $category = createCategory($product['CategoryID'], $product['CategoryName']); $product['Category'] = $category; unset($product['SupplierID']); unset($product['SupplierName']); unset($product['CategoryID']); unset($product['CategoryName']); $data['data'][$key] = $product; } echo json_encode($data);