This is a migrated thread and some comments may be shown as answers.

Short-circuit first data source read with local data?

3 Answers 20 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Brian Vallelunga
Top achievements
Rank 1
Brian Vallelunga asked on 26 Sep 2014, 03:53 PM
I have a data source that is used to fetch remote data for a grid. In my specific situation, I already have the first page of data available on the client and would like to short-circuit the data source's first read attempt and supply my local data. All subsequent requests, due to paging, etc, should happen normally, pulling from the remote data endpoint. Is this possible?

The requestStart event looks like it might be the place to intercept the call, but I'm unsure of exactly how to do this.

Thanks

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 30 Sep 2014, 10:39 AM
Hi,

This can be achieved by using a custom function for the read operation that passes the local data initially and then uses a remote request. Here is an example that demonstrates this scenario.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Brian Vallelunga
Top achievements
Rank 1
answered on 01 Oct 2014, 02:05 AM
Thanks. That is really helpful, though not quite as automatic as I had hoped. Ideally, the data source itself would perform the ajax call, but it doesn't look like there's any support for doing that. This will work for my needs though. I just need to figure out how to streamline this approach for multiple data sources.
0
Daniel
Telerik team
answered on 02 Oct 2014, 02:43 PM
Hello again,

An an alternative I can suggest an approach similar to the one that is currently used for the MVC wrappers - create a custom transport that reads the data from the data option if available. I updated the example to demonstrate this appraoch.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Brian Vallelunga
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Brian Vallelunga
Top achievements
Rank 1
Share this question
or