DevExtreme Angular - Access the DataSource
Regardless of the data source you use, the List always wraps it in the DataSource. To get the instance of the DataSource, call the getDataSource() method.
TypeScript
- import { ..., ViewChild } from "@angular/core";
- import { DxListModule, DxListComponent } from "devextreme-angular";
- // ...
- export class AppComponent {
- @ViewChild(DxListComponent, { static: false }) list: DxListComponent;
- // Prior to Angular 8
- // @ViewChild(DxListComponent) list: DxListComponent;
- listDataSource: any = {};
- getDataSource () {
- this.listDataSource = this.dataGrid.instance.getDataSource();
- }
- }
- @NgModule({
- imports: [
- // ...
- DxListModule
- ],
- // ...
- })
Now, you can call any method exposed by the DataSource. For example, you can reload data using the load() method.
JavaScript
- listDataSource.load();
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.