Devextreme same lookup in two columns, how to avoid making the request twice?

80 views Asked by At

I have two columns that have the same lookup, they send 2 requests to the same place in the API, how to call it only once and use it for both columns?

1

There are 1 answers

0
Jernej Habjan On

You could make a http request with your service to API and cache the response in new ArrayStore (wrapped in dataSource object)

this.lookupsDataSource = new DataSource({ 
    store: new ArrayStore({
        data: //yourService.retrievedData 
            key: "Id", 
        })
    });

Then you could redeclare grids columns (if you use that configuration) or you could re-set datasource of both lookups to this new arrayStore)