React SelectBox - Access the DataSource

Regardless of the data source you use, the SelectBox always wraps it in a DataSource. Call the getDataSource() method to get the instance of the DataSource.

jQuery
JavaScript
const selectBoxDataSource = $("#selectBoxContainer").dxSelectBox("getDataSource");
Angular
TypeScript
import { DxSelectBoxModule, DxSelectBoxComponent } from "devextreme-angular";
// ...
export class AppComponent {
    @ViewChild(DxSelectBoxComponent, { static: false }) selectBox: DxSelectBoxComponent;
    // Prior to Angular 8
    // @ViewChild(DxSelectBoxComponent) selectBox: DxSelectBoxComponent;
    ds: any = {};
    getDataSource () {
        this.ds = this.selectBox.instance.getDataSource();
    }
}
@NgModule({
     imports: [
         // ...
         DxSelectBoxModule
     ],
     // ...
 })

Now, you can call any method the DataSource exposes. For example, you can reload data using the reload() method.

JavaScript
selectBoxDataSource.reload();
See Also