Virtual Data Source

The Ignite UI for React Data Table / Data Grid supports binding to remote datasources with one line of code. With the React data table’s Virtual Data Source, you simply configure the React grid with your remote URI and which OData Entity you’d like returned, and the React grid does the rest of the work for you.

Demo

Dependencies

In addition to the core and React data grid packages you will also have to install the datasources package.

  • npm install --save igniteui-react-core
  • npm install --save igniteui-react-grids
  • npm install --save igniteui-react-datasources

In order to use the React grid, you need to register the IgrLiveGridModule in your app during load:

import './odatajs-4.0.0';
import { IgrLiveGridModule } from "igniteui-react-grids/ES5/igr-live-grid-module";
import { IgrLiveGrid } from "igniteui-react-grids/ES5/igr-live-grid";
import { ODataVirtualDataSource } from "igniteui-react-datasources/ES5/ODataVirtualDataSource";

IgrLiveGridModule.register();

Usage

Now that the React data grid module is imported, the next step is the basic configuration of the React grid that binds to remote data. Create the virtual datasource. Assign the url where the data will be retrieved from to the baseUri property. Setting the entitySet property will inform which table to retrieve from the virtual datasource.

private virtualData: ODataVirtualDataSource;
// ...
const vds = new ODataVirtualDataSource();
vds.baseUri = ("https://services.odata.org/V4/Northwind/Northwind.svc");
vds.entitySet = ("Orders");
this.virtualData = vds;

Assign the data source to the grid.

<IgrLiveGrid
    width="100%"
    height="100%"
    defaultColumnMinWidth={120}
    dataSource={this.virtualData}/>