Remote Datasource and Get

2 posts, 0 answers
  1. James
    James avatar
    4 posts
    Member since:
    Jan 2014

    Posted 18 Mar 2014 Link to this post


    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.

  2. Petyo
    Petyo avatar
    2444 posts

    Posted 21 Mar 2014 Link to this post

    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. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top