All Components

Grid Overview

The Grid displays data in a tabular format and provides a full spectrum of configuration options.

It supports the implementation of data operations and can be bound to local or remote data.

The Grid wrapper for Vue is a client-side wrapper for the Kendo UI Grid widget.

Installation

To initialize the Grid, either:

Initializing from CDN

The following example demonstrates how to initialize the Grid component by using the CDN services. To access all CDN references, open the sample in Plunker.

<div id="vueapp">
    <kendo-grid :data-source="localDataSource">
        <kendo-grid-column field="ProductID" title="ID" :width="40"></kendo-grid-column>
        <kendo-grid-column field="ProductName"></kendo-grid-column>
        <kendo-grid-column field="UnitPrice" title="Unit Price" :width="120" :format="'{0:c}'"></kendo-grid-column>
        <kendo-grid-column field="UnitsInStock" title="Units In Stock" :width="120"></kendo-grid-column>
        <kendo-grid-column field="Discontinued" :width="120"></kendo-grid-column>
    </kendo-grid>
</div>
Vue.use(GridInstaller);

new Vue({
    el: '#vueapp',
    data: {
        localDataSource: [{
                "ProductID": 1,
                "ProductName": "Chai",
                "UnitPrice": 18,
                "UnitsInStock": 39,
                "Discontinued": false,
            },
            {
                "ProductID": 2,
                "ProductName": "Chang",
                "UnitPrice": 17,
                "UnitsInStock": 40,
                "Discontinued": false,
            },
            {
                "ProductID": 3,
                "ProductName": "Aniseed Syrup",
                "UnitPrice": 10,
                "UnitsInStock": 13,
                "Discontinued": false,
            },
            {
                "ProductID": 4,
                "ProductName": "Chef Anton's Cajun Seasoning",
                "UnitPrice": 22,
                "UnitsInStock": 53,
                "Discontinued": false,
            },
            {
                "ProductID": 5,
                "ProductName": "Chef Anton's Gumbo Mix",
                "UnitPrice": 21.35,
                "UnitsInStock": 0,
                "Discontinued": true,
            },
            {
                "ProductID": 6,
                "ProductName": "Grandma's Boysenberry Spread",
                "UnitPrice": 25,
                "UnitsInStock": 120,
                "Discontinued": false,
            },
            {
                "ProductID": 7,
                "ProductName": "Uncle Bob's Organic Dried Pears",
                "UnitPrice": 30,
                "UnitsInStock": 15,
                "Discontinued": false,
            }
        ]
    }
})

Initializing with Webpack

  1. Install Kendo UI and add a theme.

    npm install --save @progress/kendo-ui
    npm install --save @progress/kendo-theme-default
  2. Install the Kendo UI Grid package for Vue.

    npm install --save @progress/kendo-grid-vue-wrapper
  3. Import the Kendo UI packages to the App component. If you use the Kendo UI components more than once in your application, add all Kendo UI-related files to the main.js file. If you use the Kendo UI components once in your application, add the Kendo UI-related files the component where they will be referred.

    import '@progress/kendo-ui'
    import '@progress/kendo-theme-default/dist/all.css'
    
    import { Grid, GridInstaller } from '@progress/kendo-grid-vue-wrapper'
    
    Vue.use(GridInstaller)
    
    new Vue({
       el: '#app',
       components: {
           Grid
       }
    })

Features and Functionalities

Events

The following example demonstrates basic Grid events. You can subscribe to all Grid events by the handler name.

<div id="vueapp" class="vue-app">
    <kendo-grid :data-source="localDataSource"
                v-on:databinding="onDataBinding"
                v-on:databound="onDataBound">
    </kendo-grid>
</div>
Vue.use(GridInstaller);

new Vue({
    el: '#vueapp',
    methods: {
        onDataBinding: function (ev) {
            console.log("Grid is about to be bound!");
        },
        onDataBound: function (ev) {
            console.log("Grid is now bound!");
        }
    },
    data: {
        localDataSource: [{
                "ProductID": 1,
                "ProductName": "Chai",
                "UnitPrice": 18,
                "UnitsInStock": 39,
                "Discontinued": false,
            },
            {
                "ProductID": 2,
                "ProductName": "Chang",
                "UnitPrice": 17,
                "UnitsInStock": 40,
                "Discontinued": false,
            },
            {
                "ProductID": 3,
                "ProductName": "Aniseed Syrup",
                "UnitPrice": 10,
                "UnitsInStock": 13,
                "Discontinued": false,
            }
        ]
    }
})
In this article