DataGrid

The DataGrid is a widget that represents data from a local or remote source in the form of a grid. This widget offers such basic features as sorting, grouping, filtering, as well as more advanced capabilities, like state storing, export to Excel, master-detail interface, and many others.

Included in: dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/data_grid
Export: default
DataGrid interactive configuration
Copy Code
Copy to Codepen
$("#datagrid").dxDataGrid({
});

You can create the widget using one of the following approaches.

  • jQuery

    HTML
    JavaScript
    <div id="dataGrid"></div>
    $(function () {
        $("#dataGrid").dxDataGrid({
            dataSource: customers,
            columns: ['CompanyName', 'City', 'State', 'Phone', 'Fax']
        });
    });
  • Angular

    HTML
    JavaScript
    <dx-data-grid [dataSource]="customers">            
        <dxi-column dataField="CompanyName"></dxi-column>
        <dxi-column dataField="City"></dxi-column>
        <dxi-column dataField="State"></dxi-column>
        <dxi-column dataField="Phone"></dxi-column>
        <dxi-column dataField="Fax"></dxi-column>
    </dx-data-grid>
    export class AppComponent {
        customers = [
            // ...   
        ];
    }
  • AngularJS

    HTML
    JavaScript
    <div ng-controller="DemoController">
        <div dx-data-grid="{
            dataSource: customers,
            columns: ['CompanyName', 'City', 'State', 'Phone', 'Fax']
        }"></div>
    </div>
    angular.module('DemoApp', ['dx'])
        .controller("DemoController", function ($scope) {
            $scope.customers = [
                // ...   
            ];
        });
  • Knockout

    HTML
    JavaScript
    <div data-bind="dxDataGrid: {
        dataSource: customers,
        columns: ['CompanyName', 'City', 'State', 'Phone', 'Fax']
    }"></div>
    var viewModel = {
        customers: [
            // ...
        ]
    };
    ko.applyBindings(viewModel);
  • ASP.NET MVC Wrappers

    Razor C#
    Razor VB
    @(Html.DevExtreme().DataGrid()
        .ID("dataGrid")
        .DataSource(Customers)
        .Columns(columns => {
            columns.Add().DataField("CompanyName");
            columns.Add().DataField("City");
            columns.Add().DataField("State");
            columns.Add().DataField("Phone");
            columns.Add().DataField("Fax");
        })
    )
    @(Html.DevExtreme().DataGrid() _
        .ID("dataGrid") _
        .DataSource(Customers) _
        .Columns(Sub(columns)
            columns.Add().DataField("CompanyName")
            columns.Add().DataField("City")
            columns.Add().DataField("State")
            columns.Add().DataField("Phone")
            columns.Add().DataField("Fax")
        End Sub)
    )

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the topics in the Installation section.

See Also

Start Tutorial View Demo Watch Video

Configuration

This section describes the configuration options of the DataGrid widget.

Methods

This section describes the methods that can be used to manipulate the DataGrid widget.

Events

This section describes events fired by this widget.

Row

This section describes the properties of a grid row. An object containing these properties comes to certain event-handling functions.