$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; margin: 20px auto 0;
$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';