<script id="details" type="text/x-kendo-template"> <?php $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('hierarchy.php?details=details')->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(); $filter = new \Kendo\Data\DataSourceFilterItem(); $filter->field('EmployeeID')->operator('eq')->value('#=EmployeeID#'); $dataSource->transport($transport)->pageSize(5)->schema($schema)->addFilterItem($filter)->serverSorting(true)->serverFiltering(true)->serverPaging(true); $detailGrid = new \Kendo\UI\Grid('detailGrid#=EmployeeID#'); $orderID = new \Kendo\UI\GridColumn(); $orderID->field('OrderID')->width(70)->title('Order ID'); $shipCountry = new \Kendo\UI\GridColumn(); $shipCountry->field('ShipCountry')->width(110)->title('Ship Country'); $shipAddress = new \Kendo\UI\GridColumn(); $shipAddress->field('ShipAddress')->title('Ship Address'); $shipName = new \Kendo\UI\GridColumn(); $shipName->field('ShipName')->title('Ship Name')->width(200); $detailGrid->dataSource($dataSource)->addColumn($orderID, $shipCountry, $shipAddress, $shipName)->pageable(true)->sortable(true)->scrollable(false); echo $detailGrid->renderInTemplate(); ?> </script> <script> function dataBound() {
$model = new \Kendo\Data\DataSourceSchemaModel(); $productIDField = new \Kendo\Data\DataSourceSchemaModelField('ProductID'); $productIDField->type('number')->editable(false)->nullable(true); $productNameField = new \Kendo\Data\DataSourceSchemaModelField('ProductName'); $productNameField->type('string')->validation(array('required' => true)); $unitPriceValidation = new \Kendo\Data\DataSourceSchemaModelFieldValidation(); $unitPriceValidation->required(true)->min(1); $unitPriceField = new \Kendo\Data\DataSourceSchemaModelField('UnitPrice'); $unitPriceField->type('number')->validation($unitPriceValidation); $categoryIDField = new \Kendo\Data\DataSourceSchemaModelField('CategoryID'); $categoryIDField->type('number'); $model->id('ProductID')->addField($productIDField)->addField($productNameField)->addField($unitPriceField)->addField($categoryIDField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->errors('errors')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->batch(true)->pageSize(30)->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')->format('{0:c}')->width(150)->title('Unit Price'); $categoryID = new \Kendo\UI\GridColumn(); $categoryID->field('CategoryID')->title('Category')->values($categories['data'])->width(180); $command = new \Kendo\UI\GridColumn(); $command->addCommandItem('destroy')->title(' ')->width(110); $grid->addColumn($productName, $categoryID, $unitPrice, $command)->dataSource($dataSource)->addToolbarItem(new \Kendo\UI\GridToolbarItem('create'), new \Kendo\UI\GridToolbarItem('save'), new \Kendo\UI\GridToolbarItem('cancel'))->height(400)->navigatable(true)->editable(true)->groupable(true)->pageable(true); echo $grid->render(); ?> <?php require_once '../include/footer.php';
$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(); $schema->data('data')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(10)->schema($schema)->serverFiltering(true)->serverSorting(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $orderID = new \Kendo\UI\GridColumn(); $orderID->field('OrderID')->filterable(false)->title('Order ID'); $freight = new \Kendo\UI\GridColumn(); $freight->field('Freight')->title('Freight'); $orderDate = new \Kendo\UI\GridColumn(); $orderDate->field('OrderDate')->width(120)->format('{0:MM/dd/yyyy}')->title('OrderDate'); $shipName = new \Kendo\UI\GridColumn(); $shipName->field('ShipName')->width(260)->title('Ship Name'); $shipCity = new \Kendo\UI\GridColumn(); $shipCity->field('ShipCity')->width(150)->title('Ship City'); $grid->addColumn($orderID, $freight, $orderDate, $shipName, $shipCity)->dataSource($dataSource)->sortable(true)->filterable(true)->pageable(true); echo $grid->render(); ?> <?php
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'); $address = new \Kendo\UI\GridColumn(); $address->field('Address'); $phone = new \Kendo\UI\GridColumn(); $phone->field('HomePhone'); $grid->addColumn($firstName, $lastName, $city, $address, $phone)->selectable('cell multiple')->pageable(true)->navigatable(true)->sortable(true)->filterable(true)->dataSource($dataSource); echo $grid->render(); ?> <ul class="keyboard-legend" style="padding-top: 25px"> <li>
$unitPriceField = new \Kendo\Data\DataSourceSchemaModelField('UnitPrice'); $unitPriceField->type('number'); $unitsInStockField = new \Kendo\Data\DataSourceSchemaModelField('UnitsInStock'); $unitsInStockField->type('number'); $supplierField = new \Kendo\Data\DataSourceSchemaModelField("Supplier"); $supplierField->defaultValue(new stdClass()); $categoryField = new \Kendo\Data\DataSourceSchemaModelField("Category"); $categoryField->defaultValue(new stdClass()); $model->id("ProductID")->addField($productNameField)->addField($unitPriceField)->addField($unitsInStockField)->addField($supplierField)->addField($categoryField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); // --------- Kendo UI DataSource ------- $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(5)->schema($schema)->serverPaging(true); // --------- Kendo UI Grid ------- $grid = new \Kendo\UI\Grid('grid'); $productName = new \Kendo\UI\GridColumn(); $productName->field('ProductName')->title('Product Name'); $supplier = new \Kendo\UI\GridColumn(); $supplier->field('Supplier')->title("Supplier")->editor('supplierEditor')->template("#: Supplier.SupplierName #"); $category = new \Kendo\UI\GridColumn(); $category->field('Category')->title("Category")->editor('categoryEditor')->template("#: Category.CategoryName #"); $unitPrice = new \Kendo\UI\GridColumn(); $unitPrice->field('UnitPrice')->format('{0:c}')->title('Price'); $unitsInStock = new \Kendo\UI\GridColumn(); $unitsInStock->field('UnitsInStock')->title('Stock'); $edit = new \Kendo\UI\GridColumnCommandItem('edit'); $edit->name('edit'); $destroy = new \Kendo\UI\GridColumnCommandItem('destroy'); $destroy->name('destroy'); $commandColumn = new \Kendo\UI\GridColumn();
$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'); $model->addField($productNameField)->addField($unitPriceField)->addField($unitsInStockField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(5)->schema($schema)->serverSorting(true)->serverPaging(true); $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')->format('{0:c}')->width(150)->title('Unit Price'); $unitsInStock = new \Kendo\UI\GridColumn(); $unitsInStock->field('UnitsInStock')->width(150)->title('Units In Stock'); $grid->addColumn($productName, $unitPrice, $unitsInStock)->selectable('cell multiple')->pageable(true)->sortable(true)->dataSource($dataSource)->change('onChange')->dataBound('onDataBound')->dataBinding('onDataBinding'); echo $grid->render(); ?> <script> function onChange(arg) { var selected = $.map(this.select(), function(item) { return $(item).text(); });
} 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(); $cityFilterable->ui(new \Kendo\JavaScriptFunction('cityFilter')); $city = new \Kendo\UI\GridColumn(); $city->field('City')->filterable($cityFilterable)->width(200); $titleFilterable = new \Kendo\UI\GridColumnFilterable(); $titleFilterable->ui(new \Kendo\JavaScriptFunction('titleFilter')); $title = new \Kendo\UI\GridColumn(); $title->field('Title')->filterable($titleFilterable)->width(300); $stringOperators = new \Kendo\UI\GridFilterableOperatorsString(); $stringOperators->startsWith('Starts with')->eq('Is equal to')->neq('Is not equal to'); $operators = new \Kendo\UI\GridFilterableOperators(); $operators->string($stringOperators); $filterable = new \Kendo\UI\GridFilterable();
$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(); $shipCountry->field('ShipCountry')->width(300)->title('Ship Country'); $freight = new \Kendo\UI\GridColumn(); $freight->field('Freight')->width(300); $orderDate = new \Kendo\UI\GridColumn(); $orderDate->field('OrderDate')->format('{0:dd/MM/yyyy}')->title('Order Date'); ?> <h3>Grid with multiple row selection enabled</h3> <?php $grid = new \Kendo\UI\Grid('rowSelection'); $grid->addColumn($shipCountry, $freight, $orderDate)->dataSource($dataSource)->navigatable(true)->scrollable(false)->selectable('row multiple')->sortable(true)->pageable(true); echo $grid->render(); ?> <h3>Grid with multiple cell selection enabled</h3> <?php $grid = new \Kendo\UI\Grid('cellSelection'); $grid->addColumn($shipCountry, $freight, $orderDate)->dataSource($dataSource)->navigatable(true)->scrollable(false)->selectable('cell multiple')->sortable(true)->pageable(true); echo $grid->render(); ?> <?php require_once '../include/footer.php';
<script id="details" type="text/x-kendo-template"> <?php $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('hierarchy.php?details=details')->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(); $filter = new \Kendo\Data\DataSourceFilterItem(); $filter->field('EmployeeID')->operator('eq')->value('#=EmployeeID#'); $dataSource->transport($transport)->pageSize(5)->schema($schema)->addFilterItem($filter)->serverSorting(true)->serverFiltering(true)->serverPaging(true); $detailGrid = new \Kendo\UI\Grid('detailGrid#=EmployeeID#'); $orderID = new \Kendo\UI\GridColumn(); $orderID->field('OrderID')->width(70)->title('Order ID'); $shipCountry = new \Kendo\UI\GridColumn(); $shipCountry->field('ShipCountry')->width(110)->title('Ship Country'); $shipAddress = new \Kendo\UI\GridColumn(); $shipAddress->field('ShipAddress')->title('Ship Address'); $shipName = new \Kendo\UI\GridColumn(); $shipName->field('ShipName')->title('Ship Name')->width(200); $detailGrid->dataSource($dataSource)->addColumn($orderID, $shipCountry, $shipAddress, $shipName)->pageable(true)->sortable(true)->scrollable(false); $orders = new \Kendo\UI\TabStripItem(); $orders->text('Orders')->selected(true)->content($detailGrid->renderInTemplate()); //add grid to the tabstrip item content $contact = new \Kendo\UI\TabStripItem(); $contact->text('Contact Information'); $contact->startContent();
}'); $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(); $dataSource->transport($transport)->pageSize(10)->serverPaging(true)->serverSorting(true)->serverGrouping(true)->schema($schema); $grid = new \Kendo\UI\Grid('grid'); $contactName = new \Kendo\UI\GridColumn(); $contactName->field('ContactName')->title('Contact Name')->width(140); $contactTitle = new \Kendo\UI\GridColumn(); $contactTitle->field('ContactTitle')->title('Contact Title')->width(190); $companyName = new \Kendo\UI\GridColumn(); $companyName->field('CompanyName')->title('Company Name'); $Country = new \Kendo\UI\GridColumn(); $Country->field('Country')->width(110); $pageable = new Kendo\UI\GridPageable(); $pageable->refresh(true)->pageSizes(true)->buttonCount(5); $grid->addColumn($contactName, $contactTitle, $companyName, $Country)->dataSource($dataSource)->sortable(true)->groupable(true)->pageable($pageable)->attr('style', 'height:380px'); ?> <div id="clientsDb"> <?php
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(); $command->click('commandClick')->text('View Details'); $commandColumn = new \Kendo\UI\GridColumn(); $commandColumn->addCommandItem($command)->title(' ')->width(140); $grid->addColumn($firstName, $lastName, $title, $commandColumn)->dataSource($dataSource)->height(260)->pageable(true); echo $grid->render(); $window = new \Kendo\UI\Window('details'); $window->title('Customer Details')->modal(true)->visible(false)->resizable(false)->width(300); echo $window->render();
exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('api.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('UnitsInStock'); $dataSource->transport($transport)->pageSize(5)->addGroupItem($group)->schema($schema)->serverSorting(true)->serverGrouping(true)->serverPaging(true); $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')->format('{0:c}')->title('Unit Price'); $unitsInStock = new \Kendo\UI\GridColumn(); $unitsInStock->field('UnitsInStock')->title('Units In Stock'); $grid->addColumn($productName, $unitPrice, $unitsInStock)->attr('style', 'width:700px')->selectable('row multiple')->pageable(true)->sortable(true)->groupable(true)->dataSource($dataSource); ?> <div class="configuration k-widget k-header" style="width:190px"> <span class="configHead">API Functions</span> <ul class="options"> <li> <input type="text" value="0" id="selectRow" class="k-textbox"/> <button class="selectRow k-button">Select row</button>
$schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->errors('errors')->groups('groups')->aggregates('aggregates')->total('total'); $productNameCount = new \Kendo\Data\DataSourceAggregateItem(); $productNameCount->field("ProductName")->aggregate("count"); $unitsOnOrderAvg = new \Kendo\Data\DataSourceAggregateItem(); $unitsOnOrderAvg->field("UnitsOnOrder")->aggregate("average"); $unitsInStockMin = new \Kendo\Data\DataSourceAggregateItem(); $unitsInStockMin->field("UnitsInStock")->aggregate("min"); $unitsInStockMax = new \Kendo\Data\DataSourceAggregateItem(); $unitsInStockMax->field("UnitsInStock")->aggregate("max"); $unitsInStockCount = new \Kendo\Data\DataSourceAggregateItem(); $unitsInStockCount->field("UnitsInStock")->aggregate("count"); $group = new \Kendo\Data\DataSourceGroupItem(); $group->field('UnitsInStock')->addAggregate($productNameCount, $unitsOnOrderAvg, $unitsInStockMin, $unitsInStockMax, $unitsInStockCount); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(7)->serverPaging(true)->serverSorting(true)->serverGrouping(true)->serverFiltering(true)->serverAggregates(true)->addGroupItem($group)->addAggregateItem($productNameCount, $unitsOnOrderAvg, $unitsInStockMin, $unitsInStockMax)->schema($schema); $grid = new \Kendo\UI\Grid('grid'); $productName = new \Kendo\UI\GridColumn(); $productName->field('ProductName')->footerTemplate('Total Count: #=count#')->groupFooterTemplate('Count: #=count#')->title('Product Name'); $unitPrice = new \Kendo\UI\GridColumn(); $unitPrice->field('UnitPrice')->format('{0:c}')->width(150)->title('Unit Price'); $unitsOnOrder = new \Kendo\UI\GridColumn(); $unitsOnOrder->field('UnitsOnOrder')->width(150)->footerTemplate('Average: #=average#')->groupFooterTemplate('Average: #=average#')->title('Units On Order'); $unitsInStock = new \Kendo\UI\GridColumn(); $unitsInStock->field('UnitsInStock')->width(150)->footerTemplate('<div>Min: #= min #</div><div>Max: #= max #</div>')->groupHeaderTemplate('Units In Stock: #= value # (Count: #= count#)')->title('Units In Stock'); $grid->addColumn($productName, $unitPrice, $unitsOnOrder, $unitsInStock)->dataSource($dataSource)->scrollable(false)->sortable(true)->pageable(true); echo $grid->render(); ?> <?php require_once '../include/footer.php';
$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'); $shipCity = new \Kendo\UI\GridColumn(); $shipCity->field('ShipCity')->width(110)->title('Ship City'); $shipCountry = new \Kendo\UI\GridColumn(); $shipCountry->field('ShipCountry')->width(110)->title('Ship Country'); $scrollable = new \Kendo\UI\GridScrollable(); $scrollable->virtual(true); $grid->addColumn($orderID, $customerID, $shipName, $shipAddress, $shipCity, $shipCountry)->dataSource($dataSource)->scrollable($scrollable)->sortable(true)->height(430);
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(); $dataSource->transport($transport)->pageSize(30)->schema($schema)->serverSorting(true)->serverFiltering(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $orderID = new \Kendo\UI\GridColumn(); $orderID->field('OrderID')->width(130)->title('Order ID'); $shipCountry = new \Kendo\UI\GridColumn(); $shipCountry->field('ShipCountry')->width(160)->title('Ship Country'); $shipName = new \Kendo\UI\GridColumn(); $shipName->field('ShipName')->title('Ship Name')->width(220); $shipAddress = new \Kendo\UI\GridColumn(); $shipAddress->field('ShipAddress')->filterable(false)->title('Ship Address'); $grid->dataSource($dataSource)->addColumn($orderID, $shipCountry, $shipName, $shipAddress)->height(430)->columnMenu(true)->pageable(true)->sortable(true)->filterable(true); echo $grid->render(); ?> <?php require_once '../include/footer.php';
$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); echo $grid->render(); $sortable = new \Kendo\UI\Sortable('#grid table'); // select the container for the Sortable $sortable->hint(new \Kendo\JavaScriptFunction('hint'))->placeholder(new \Kendo\JavaScriptFunction('placeholder'))->filter('>tbody >tr')->cursor('move')->container('#grid tbody')->change('onChange'); echo $sortable->render(); ?>
} 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(); $productName->field('ProductName')->title('Product Name'); $unitPrice = new \Kendo\UI\GridColumn(); $unitPrice->field('UnitPrice')->width(100)->title('Unit Price'); $quantityPerUnit = new \Kendo\UI\GridColumn(); $quantityPerUnit->field('QuantityPerUnit')->title('Quantity Per Unit'); $grid->addColumn($productID, $productName, $unitPrice, $quantityPerUnit)->dataSource($dataSource)->height(430)->sortable(true)->pageable(true)->toolbarTemplateId('toolbar'); echo $grid->render(); ?> <script id="toolbar" type="text/x-kendo-template"> <div class="toolbar">
}'); $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(); $dataSource->transport($transport)->pageSize(15)->serverPaging(true)->serverSorting(true)->serverGrouping(true)->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')->format('{0:c}')->width(130)->title('Unit Price'); $unitsInStock = new \Kendo\UI\GridColumn(); $unitsInStock->field('UnitsInStock')->width(130)->title('Units In Stock'); $discontinued = new \Kendo\UI\GridColumn(); $discontinued->field('Discontinued')->width(130); $grid->addColumn($productName, $unitPrice, $unitsInStock, $discontinued)->dataSource($dataSource)->height(430)->sortable(true)->resizable(true)->pageable(true); ?> <div class="k-rtl"> <?php echo $grid->render(); ?>
$productNameField = new \Kendo\Data\DataSourceSchemaModelField('ProductName'); $productNameField->type('string')->validation(array('required' => true)); $unitPriceValidation = new \Kendo\Data\DataSourceSchemaModelFieldValidation(); $unitPriceValidation->required(true)->min(1); $unitPriceField = new \Kendo\Data\DataSourceSchemaModelField('UnitPrice'); $unitPriceField->type('number')->validation($unitPriceValidation); $unitsInStockField = new \Kendo\Data\DataSourceSchemaModelField('UnitsInStock'); $unitsInStockField->type('number'); $discontinuedField = new \Kendo\Data\DataSourceSchemaModelField('Discontinued'); $discontinuedField->type('boolean'); $model->id('ProductID')->addField($productIDField)->addField($productNameField)->addField($unitPriceField)->addField($unitsInStockField)->addField($discontinuedField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->errors('errors')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->batch(true)->pageSize(20)->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')->format('{0:c}')->width(100)->title('Unit Price'); $unitsInStock = new \Kendo\UI\GridColumn(); $unitsInStock->field('UnitsInStock')->width(100)->title('Units In Stock'); $discontinued = new \Kendo\UI\GridColumn(); $discontinued->field('Discontinued')->width(100); $command = new \Kendo\UI\GridColumn(); $command->addCommandItem('edit')->addCommandItem('destroy')->title(' ')->width(160); $grid->addColumn($productName, $unitPrice, $unitsInStock, $discontinued, $command)->dataSource($dataSource)->addToolbarItem(new \Kendo\UI\GridToolbarItem('create'))->height(430)->editable('popup')->pageable(true); echo $grid->render(); ?> <?php
$countryField = new \Kendo\Data\DataSourceSchemaModelField('Country'); $countryField->type('string'); $photoField = new \Kendo\Data\DataSourceSchemaModelField('Photo'); $photoField->type('string'); $model->addField($employeeIDField)->addField($firstNameField)->addField($lastNameField)->addField($countryField)->addField($photoField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->schema($schema); $picture = new \Kendo\UI\GridColumn(); $picture->field('EmployeeID')->width(110)->title('Picture'); $details = new \Kendo\UI\GridColumn(); $details->width(600)->title('Details'); $id = new \Kendo\UI\GridColumn(); $id->title('ID'); $grid = new \Kendo\UI\Grid('grid'); $grid->dataSource($dataSource)->addColumn($picture, $details, $id)->rowTemplateId('row-template')->altRowTemplateId('alt-row-template')->height(430); echo $grid->render(); ?> <script id="row-template" type="text/x-kendo-template"> <tr data-uid="#: uid #"> <td class="photo"> <img src="../content/web/Employees/#:EmployeeID#.jpg" alt="#: EmployeeID #" /> </td> <td class="details"> <span class="title">#: Title #</span> <span class="description">Name : #: FirstName# #: LastName#</span> <span class="description">Country : #: Country# </span> </td> <td class="employeeID">