示例#1
0
$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() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>

<?php 
require_once '../include/footer.php';
示例#2
0
$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';
示例#3
0
$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('&nbsp;')->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';
示例#4
0
$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';
示例#5
0
 public function __construct(array $cfg)
 {
     if (isset($cfg['primary'])) {
         $this->id = isset($cfg['id']) ? $cfg['id'] : \bbn\str\text::genpwd();
         $this->primary = $cfg['primary'];
         if (!isset($cfg['builder'])) {
             $cfg['builder'] = new \bbn\html\builder();
         }
         $this->builder = $cfg['builder'];
         $this->grid = new \Kendo\UI\Grid($this->id);
         $this->dataSource = new \Kendo\Data\DataSource();
         if (isset($cfg['data'])) {
             $this->dataSource->data($cfg['data']);
         }
         $this->schema = new \Kendo\Data\DataSourceSchema();
         $this->schema->data('data');
         $this->schema->total('total');
         $this->model = new \Kendo\Data\DataSourceSchemaModel();
         $this->model->id($cfg['primary']);
         foreach ($cfg['elements'] as $e) {
             if (isset($e['attr']['name'])) {
                 $field = new \Kendo\Data\DataSourceSchemaModelField($e['attr']['name']);
                 if (isset($e['attr']['name']) && isset($e['editable']) && $e['editable']) {
                     if (isset($e['type'])) {
                         $field->type($e['type']);
                     }
                     if (isset($e['null']) && $e['null']) {
                         $field->nullable(true);
                     }
                     if (isset($e['attr']['readonly']) && $e['attr']['readonly']) {
                         $field->editable(false);
                     } else {
                         if (isset($e['validation'])) {
                             $field->validation($e['validation']);
                         }
                     }
                     $this->model->addField($field);
                 }
                 if (empty($e['editable'])) {
                     $field->editable(false);
                 }
                 if (!empty($e['default'])) {
                     $field->defaultValue($e['default']);
                 }
             }
             $col = new \Kendo\UI\GridColumn();
             if (!isset($e['field']) || $e['field'] !== 'hidden') {
                 if (isset($e['editable']) && $e['editable']) {
                     /*
                                 if ( !isset($e['editor']) ){
                      $input = $this->builder->input($e, 1);
                      $sc = $input->ele_and_script();
                      $e['editor'] = new \Kendo\JavaScriptFunction('function(container, options) {
                        '.$sc[0].'.appendTo(container)'.$sc[1].'
                      }');
                                 }
                                 $col->editor($e['editor']);
                     * 
                     */
                 }
                 if (isset($e['raw'])) {
                     $col->encoded(false);
                 }
                 if (isset($e['data'])) {
                     $col->values($e['data']);
                 }
                 if (isset($e['label'])) {
                     $col->title($e['label']);
                 }
                 if (isset($e['attr']['name'])) {
                     $col->field($e['attr']['name']);
                 }
                 if (isset($e['width'])) {
                     $col->width((int) $e['width']);
                 }
                 if (isset($e['format'])) {
                     $col->format('{0:' . $e['format'] . '}');
                 }
                 if (isset($e['hidden'])) {
                     $col->hidden(true);
                 }
                 if (isset($e['template'])) {
                     $col->template($e['template']);
                 }
                 if (isset($e['editor'])) {
                     $col->editor($e['editor']);
                 }
                 if (isset($e['encoded'])) {
                     $col->encoded($e['encoded']);
                 }
                 if (isset($e['commands'])) {
                     foreach ($e['commands'] as $c) {
                         if (isset($c['click'])) {
                             $c['click'] = new \Kendo\JavaScriptFunction($c['click']);
                         }
                         $col->addCommandItem($c);
                     }
                 }
                 if (count(\bbn\tools::to_array($col)) > 0) {
                     $this->grid->addColumn($col);
                 }
             }
         }
         if (isset($cfg['url'])) {
             $this->transport = new \Kendo\Data\DataSourceTransport();
             if (isset($cfg['all'])) {
                 $this->set_all($cfg['url']);
             } else {
                 if (isset($cfg['select'])) {
                     $this->set_select($cfg['select'] === 1 || $cfg['select'] === 'on' ? 'json/select/' . $cfg['url'] : $cfg['select']);
                 }
                 if (isset($cfg['insert'])) {
                     $this->set_insert($cfg['insert'] === 1 || $cfg['insert'] === 'on' ? 'json/insert/' . $cfg['url'] : $cfg['insert']);
                 }
                 if (isset($cfg['update'])) {
                     $this->set_update($cfg['update'] === 1 || $cfg['update'] === 'on' ? 'json/update/' . $cfg['url'] : $cfg['update']);
                 }
                 if (isset($cfg['delete'])) {
                     $this->set_delete($cfg['delete'] === 1 || $cfg['delete'] === 'on' ? 'json/delete/' . $cfg['url'] : $cfg['delete']);
                 }
             }
             $this->dataSource->transport($this->transport);
         }
         if (isset($cfg['data'])) {
             $this->dataSource->data($cfg['data']);
         }
         $this->schema->model($this->model);
         $this->dataSource->schema($this->schema)->pageSize(50);
         $this->grid->attr("class", "appui-full-height")->datasource($this->dataSource)->editable(['mode' => 'popup'])->filterable(true)->resizable(true)->sortable(true)->groupable(true)->pageable(true)->columnMenu(true)->edit(new \Kendo\JavaScriptFunction('function(){
             $(".k-edit-form-container").parent().css({
               height:"auto",
               width:720,
               "max-height":appui.v.height-100
             }).restyle().data("kendoWindow").title("' . \bbn\str\text::escape_dquotes($cfg['description']) . '").center();
            }'));
         $this->cfg['args'] = [$this->id];
         $this->cfg['datasource']['schema']['model']['id'] = $this->primary;
     }
 }
$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();
$commandColumn->addCommandItem($edit)->addCommandItem($destroy);
$create = new \Kendo\UI\GridToolbarItem('create');
示例#7
0
$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('&nbsp;')->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>
示例#8
0
文件: events.php 项目: neevan1e/Done
$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();
        });

        kendoConsole.log("Selected: " + selected.length + " item(s), [" + selected.join(", ") + "]");
    }

    function onDataBound(arg) {
        kendoConsole.log("Grid data bound");
示例#9
0
文件: api.php 项目: neevan1e/Done
$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>
        </li>
        <li>
            <button class="clearSelection k-button">Clear selected rows</button>
        </li>
        <li>
            <input type="text" value="0" id="groupRow" class="k-textbox"/>
示例#10
0
文件: index.php 项目: neevan1e/Done
$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 $grid->render();
?>
</div>  

<style scoped>
    #clientsDb {
        width: 952px;
        height: 396px;
示例#11
0
$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';
$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';
示例#13
0
$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();
$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: {
示例#14
0
              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';
示例#15
0
$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();
$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();
?>
示例#16
0
              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">
    <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);
示例#17
0
$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>
            <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>
示例#18
0
$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('&nbsp;')->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';
示例#19
0
$employeeIDField->type('number');
$firstNameField = new \Kendo\Data\DataSourceSchemaModelField('FirstName');
$firstNameField->type('string');
$lastNameField = new \Kendo\Data\DataSourceSchemaModelField('LastName');
$lastNameField->type('string');
$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">