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

Remote Datasource and Get

1 Answer 39 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 18 Mar 2014, 03:22 PM
Hi,

I have been developing an app using local data while the server side stuff has been developed. I am now in the process of transitioning the local data sources to point to remote data points. The data is supplied through a custom web-socket/json protocol. It fits pretty well (I have written a custom transport read function)

One of the tasks I am trying to carry out is proving to be a little tricky: We have a table of *heavy* objects on the backend and we only ever want to access one at a time. The navigation of the app works like this:

[Light data, whole list is fetched on app startup]        ->  [Heavy data, loaded when navigating to this page]
Page containing list of titles                                          ->  Detailed information on title 

What I had before was a "selectTitle" method in a kendo.observable which would call "get" on the data source to select the title we are currently interested in. This worked well. (We also performed a few other operations, like filtering other data sources)

This does not work after transitioning to a remote data source - "get" returns undefined, I'm guessing it is to do with "get" assuming the data is already loaded into the data source. This is behaviour that we do not want. 

To sum up: We would like a way to retrieve information on a particular title from the backend, only when navigating to the view which displays that data.

Regards,
    James

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 21 Mar 2014, 02:01 PM
Hello James,

In general, the datasource abstraction is suitable for fetching and manipulating sets of records. Fetching a single record through it is not optimal - in fact, the only way to do this is to temporarily set page size to 1, but this is more of a hack.

What I may recommend in this case is to perform a jQuery ajax request for the particular title record details data instead - the fetched result may be passed through the observable model and displayed accordingly. 

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