}'); $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"> <label class="category-label" for="category">Show products by category:</label> <?php $transport = new \Kendo\Data\DataSourceTransport(); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('toolbar-template.php?type=categories')->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(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(); $lastName->field('LastName')->width(110)->title('Last Name'); $country = new \Kendo\UI\GridColumn(); $country->field('Country')->width(110); $city = new \Kendo\UI\GridColumn(); $city->field('City')->width(110); $title = new \Kendo\UI\GridColumn(); $title->field('Title'); $grid->addColumn($firstName, $lastName, $country, $city, $title)->dataSource($dataSource)->height(430)->sortable(true)->pageable(true)->dataBound('dataBound')->detailTemplateId('details'); echo $grid->render(); ?> <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();
$orderIDField->type('number'); $shipCountryField = new \Kendo\Data\DataSourceSchemaModelField('ShipCountry'); $shipCountryField->type('string'); $shipCityField = new \Kendo\Data\DataSourceSchemaModelField('ShipCity'); $shipCityField->type('string'); $shipNameField = new \Kendo\Data\DataSourceSchemaModelField('ShipName'); $shipNameField->type('string'); $shipAddressField = new \Kendo\Data\DataSourceSchemaModelField('ShipAddress'); $shipAddressField->type('string'); $model->addField($orderIDField)->addField($shipCountryField)->addField($shipCityField)->addField($shipNameField)->addField($shipAddressField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->pageSize(30)->schema($schema)->serverFiltering(true)->serverSorting(true)->serverGrouping(true)->serverPaging(true); $grid = new \Kendo\UI\Grid('grid'); $orderID = new \Kendo\UI\GridColumn(); $orderID->field('OrderID')->locked(true)->lockable(false)->width(120)->title('Order ID'); $shipCountry = new \Kendo\UI\GridColumn(); $shipCountry->field('ShipCountry')->width(200)->title('Ship Country'); $shipCity = new \Kendo\UI\GridColumn(); $shipCity->field('ShipCity')->width(160)->title('Ship City'); $shipName = new \Kendo\UI\GridColumn(); $shipName->field('ShipName')->width(200)->locked(true)->title('Ship Name'); $shipAddress = new \Kendo\UI\GridColumn(); $shipAddress->field('ShipAddress')->width(300)->lockable(false)->title('Ship Address'); $grid->addColumn($orderID, $shipCountry, $shipCity, $shipName, $shipAddress)->height(430)->scrollable(true)->dataSource($dataSource)->groupable(true)->reorderable(true)->resizable(true)->columnMenu(true)->sortable(true)->filterable(true)->pageable(true); echo $grid->render(); ?> <?php require_once '../include/footer.php';
$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->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 require_once '../include/footer.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); echo $grid->render(); ?> <?php require_once '../include/footer.php';
$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> <span class="button-preview"> <span class="key-button leftAlign">Alt</span> + <span class="key-button">w</span> </span> <span class="button-descr"> focuses the widget </span> </li> </ul>
$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';
$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(); ?> <script> var hint = $.noop; function placeholder(element) { return element.clone().addClass("k-state-hover").css("opacity", 0.65); } function onChange(e) {
$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 $grid->render(); ?> </div> <style scoped> #clientsDb { width: 952px; height: 396px; margin: 20px auto 0; padding: 51px 4px 0 4px; background: url('../content/web/grid/clientsDb.png') no-repeat 0 0;
$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(); ?> <script type="text/x-kendo-template" id="template"> <div id="details-container"> <h2>#= FirstName # #= LastName #</h2> <em>#= Title #</em> <dl> <dt>City: #= City #</dt> <dt>Address: #= Address #</dt> </dl> </div>
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> </li> <li> <button class="clearSelection k-button">Clear selected rows</button> </li> <li> <input type="text" value="0" id="groupRow" class="k-textbox"/> <button class="toggleGroup k-button">Collapse/Expand group</button>
$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(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')->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'); $pageable = new \Kendo\UI\GridPageable(); $pageable->input(true)->numeric(false); $grid->addColumn($productName)->addColumn($unitPrice)->addColumn($unitsInStock)->addColumn($discontinued)->dataSource($dataSource)->height(430)->sortable(true)->filterable(true)->pageable($pageable); echo $grid->render(); ?> <?php require_once '../include/footer.php';
$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';
$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(); }); kendoConsole.log("Selected: " + selected.length + " item(s), [" + selected.join(", ") + "]"); } function onDataBound(arg) { kendoConsole.log("Grid data bound"); }
$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(); ?> </div> <?php require_once '../include/footer.php';
$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 require_once '../include/footer.php';
$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(); $filterable->extra(false)->operators($operators); $grid->addColumn($name, $city, $title)->dataSource($dataSource)->filterable($filterable); echo $grid->render(); ?> <script> function cityFilter(element) { element.kendoDropDownList({ dataSource: { transport: { read: { url: "filter-menu-customization.php?details=city", type: "POST" } }, schema: { data: "data"