Create a basic data grid with Kendo UI and AngularJS


Node newbie

I am trying out AngularJS. I want to show a basic kendo grid. I am trying to do this using pure directives. With that in mind, I looked into the Kendo UI/Angular JS project ( https://github.com/kendo-labs/angular-kendo ). Unfortunately, my

index.html:

<div>Products: {{products.length}}</div>
<div kendo-grid k-data-source="products" k-selectable="'row'"
  k-pageable='{ "refresh": true, "pageSizes": true }'
  k-columns='[
    { "field": "Name", "title": "Name"},
    { "field": "Department", "title": "Department"},
    { "field": "LastShipment", "title": "Last Shipment" }
  ]'>
</div>

controllers.js

function myController($scope) {
    console.log("initializing controller...");
    $scope.products = [
        { id:1, name:'Tennis Balls', department:'Sports', lastShipment:'10/01/2013' },
        { id:2, name:'Basket Balls', department:'Sports', lastShipment:'10/02/2013' },
        { id:3, name:'Oil', department:'Auto', lastShipment:'10/01/2013' },
        { id:4, name:'Filters', department:'Auto', lastShipment:'10/01/2013' },
        { id:5, name:'Dresser', department:'Home Furnishings', lastShipment:'10/01/2013' }
    ];
}

I have verified that the controller is connected correctly. Activity counts are displayed correctly. However, the grid does not appear. I can't figure out what I'm doing.

thanks for your help.

阿塔纳斯 · (anas Atanas Korchev (

The field name appears to be misspelled. The following worked for me:

<div kendo-grid k-data-source="products" k-selectable="'row'"
k-pageable='{ "pageSize": 2, "refresh": true, "pageSizes": true }'
  k-columns='[
    { "field": "name", "title": "Name"},
    { "field": "department", "title": "Department"},
    { "field": "lastShipment", "title": "Last Shipment" }
  ]'>
</div>

Here's a live demo : http://jsbin.com/odeQAfI/2/edit

To avoid NaN messages in the pager, you need to productsset this field to the Kendo data source:

function MyController($scope) {
   $scope.products = new kendo.data.DataSource({ 
     data: [
        { id:1, name:'Tennis Balls', department:'Sports', lastShipment:'10/01/2013' },
        { id:2, name:'Basket Balls', department:'Sports', lastShipment:'10/02/2013' },
        { id:3, name:'Oil', department:'Auto', lastShipment:'10/01/2013' },
        { id:4, name:'Filters', department:'Auto', lastShipment:'10/01/2013' },
        { id:5, name:'Dresser', department:'Home Furnishings', lastShipment:'10/01/2013' }
    ],
     pageSize: 2
  });
}

Here is a live demo : http://jsbin.com/ODElUfO/2/edit

Related


Sort Grid data in Kendo UI Grid

Masood I want to sort the retrieved data to the description field, but I can't sort it. UI code: Display data correctly var gridDataSource = new kendo.data.DataSource({ autoSync: true, data: transformation.Activities, schema: { model: {

kendo-ui grid inline edit angularjs

Skild I want to do inline editing in kendo-ui grid. The data binding seems to work fine, but when I click the "update" button after editing something, the range gets updated, but the edit dialog doesn't disappear. If another edit button is clicked, it will go

Kendo UI Grid persistent state in AngularJS

Brammekuhh I'm having some issues loading the saved state of a grid in Angular. Here is the table HTML: <div id="grid" kendo-grid k-options="GridOptions" k-ng-delay="GridOptions"></div> Later, I start the Http call, and populate the $scope.GridOptions, and th

kendo-ui grid inline edit angularjs

Skild I want to do inline editing in kendo-ui grid. The data binding seems to work fine, but when I click the "update" button after editing something, the range gets updated, but the edit dialog doesn't disappear. If another edit button is clicked, it will go

kendo-ui grid inline edit angularjs

Skild I want to do inline editing in kendo-ui grid. The data binding seems to work fine, but when I click the "update" button after editing something, the range gets updated, but the edit dialog doesn't disappear. If another edit button is clicked, it will go

Kendo UI AngularJs grid directive, undefined

Lars 335 In the ticket entry page, I have a main ticketEntry.html page with a grid line and a payment grid. When ticketEntry.html is loaded, it must first retrieve the ticket view model (via an Ajax call to the Web API). Rows and Payments grids cannot retrieve

Kendo UI Grid persistent state in AngularJS

Brammekuhh I'm having some issues loading the saved state of a grid in Angular. Here is the table HTML: <div id="grid" kendo-grid k-options="GridOptions" k-ng-delay="GridOptions"></div> Later, I start the Http call, and populate the $scope.GridOptions, and th

kendo-ui grid inline edit angularjs

Skild I want to do inline editing in kendo-ui grid. The data binding seems to work fine, but when I click the "update" button after editing something, the range gets updated, but the edit dialog doesn't disappear. If another edit button is clicked, it will go

kendo-ui grid inline edit angularjs

Skild I want to do inline editing in kendo-ui grid. The data binding seems to work fine, but when I click the "update" button after editing something, the range gets updated, but the edit dialog doesn't disappear. If another edit button is clicked, it will go

Dynamically create grid for Angular in Kendo UI

ps0604 Kendo UI for Angular has a grid that can be defined as follows: <kendo-grid [data]="gridData" [height]="410"> <kendo-grid-column field="ProductID" title="ID" width="40"> </kendo-grid-column> <kendo-grid-column field="

Dynamically create grid for Angular in Kendo UI

ps0604 Kendo UI for Angular has a grid that can be defined as follows: <kendo-grid [data]="gridData" [height]="410"> <kendo-grid-column field="ProductID" title="ID" width="40"> </kendo-grid-column> <kendo-grid-column field="

Kendo UI Web - Grid Create/Update/Delete

no time I'm having issues with Kendo UI Web and datasources. The read works fine, I've serialized the database objects with JSON and am able to view them in the grid. I need some pointers on how to make create, update and delete work. By the way, I'm using the

Kendo UI Web - Grid Create/Update/Delete

no time I'm having issues with Kendo UI Web and datasources. The read works fine, I've serialized the database objects with JSON and am able to view them in the grid. I need some pointers on how to make create, update and delete work. By the way, I'm using the

Dynamically create grid for Angular in Kendo UI

ps0604 Kendo UI for Angular has a grid that can be defined as follows: <kendo-grid [data]="gridData" [height]="410"> <kendo-grid-column field="ProductID" title="ID" width="40"> </kendo-grid-column> <kendo-grid-column field="

Kendo UI Web - Grid Create/Update/Delete

no time I'm having issues with Kendo UI Web and datasources. The read works fine, I've serialized the database objects with JSON and am able to view them in the grid. I need some pointers on how to make create, update and delete work. By the way, I'm using the

Unable to bind data using Kendo ui grid

Natalaran Nagarazugari This is my action method public ActionResult Kendo([DataSourceRequest]DataSourceRequest request ) { var emp = EmployeeManager.GetAllEmployees(); DataSourceResult result = emp.ToDataSourceResult(request); ret

Kendo UI Grid, sorting data source groups

Ben Cameron I have a page with a kendo grid on it. It is calling ajaz web request to get its data. After the data is returned, it will be grouped on the front end. The problem I'm having is sorting the groups. What's the best way to do this? My MVC view code l

Export data from Kendo-UI grid

User 1451111 The KendoUI grid code in my app is declarative like this: <kendo-grid id="myGrid" options="mainGridOptions"> <kendoGridToolbarTemplate> <button kendoGridExcelCommand>Export to Excel</button> <kendo-grid-excel fileName="Gri

kendo ui grid data not showing from php

username I want to display data into my kendo grid. I am using basic php mysql to return results from database. Here is my kendo javascript code. <script> $(document).ready(function () { $("#grid").kendoGrid({ dataSource: {

Unable to bind data using Kendo ui grid

Natalaran Nagarazugari This is my action method public ActionResult Kendo([DataSourceRequest]DataSourceRequest request ) { var emp = EmployeeManager.GetAllEmployees(); DataSourceResult result = emp.ToDataSourceResult(request); ret

Kendo UI Grid pass data to another form

Nixon I have this demo related to my situation , how to bind additional data dataSourceinto my popup form. If, a popup form will appear outletType = rest. thanks for your help. Dojo Demo don't vote for me You don't need to set extra data , data from all data s

How to manually load data in Kendo UI grid

Taversi I have a kendo ui grid. I want to load the grid manually. For example, when my page loads, the grid doesn't load, but when I click the button, the data loads into the grid. what should I do? thanks. Johnny Hong Kong Automatic loading from the grid's da

Kendo UI, grid, modify data before sending

Internet duvet Is it possible to access and modify data in the Kendo UI grid before updating? Below is an example to illustrate what I need. There is no real convenient form in options.datacontaining the sent data, but it has been formatted as a string ."model

Kendo UI Grid select by data item

ablago I have a Kendo UI grid with a large data source and paging. I have an event that fires where I know the underlying data item to be selected, but not sure how to paginate/select the item in the grid programmatically. If the item is not on the current gri