All docs
V20.2
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Access the DataSource

Regardless of the data source you use, the DataGrid always wraps it in the DataSource. To get a DataSource instance, call the getDataSource() method.

jQuery
JavaScript
var ds = $("#dataGridContainer").dxDataGrid("getDataSource");
Angular
TypeScript
import { ..., ViewChild } from "@angular/core";
import { DxDataGridModule, DxDataGridComponent } from "devextreme-angular";
// ...
export class AppComponent {
    @ViewChild(DxDataGridComponent, { static: false }) dataGrid: DxDataGridComponent;
    // Prior to Angular 8
    // @ViewChild(DxDataGridComponent) dataGrid: DxDataGridComponent;
    ds: any = {};
    getDataSource () {
        this.ds = this.dataGrid.instance.getDataSource();
    }
}
@NgModule({
    imports: [
        // ...
        DxDataGridModule
    ],
    // ...
})

You can now call any method exposed by the DataSource. For example, you can reload data using the reload() method.

JavaScript
ds.reload();
See Also