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

getByUid returns undefined unexpectedly

3 Answers 429 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Kenny
Top achievements
Rank 1
Kenny asked on 25 Apr 2013, 06:13 PM
I have Data Source is set up to read JSON from my server for a Grid with scrollable.virtual = true.

The problem I've noticed is that the getByUid Data Source method returns undefined if the data item being requested has scrolled off the grid. For example, my Data Source transport is configured to retrieve 100 rows. The grid load, I get rows 1-100 back. The scrollbar of the grid is dragged down to row ~700. A number of requests are skipped, a request is made to the server for page 7. 

Now if I call getByUid with a UID for a data item that I know was in the first 100 items, the Data Source returns undefined. But when I inspect the Data Source I can still see that the data item is in one of the Range collections. If I get getByUid with a UID that is currently 'visible', I do get the data item back. I would expect that the Data Source would return the object regardless of whether is is currently in view or not. Is this a bug? 

Kenny

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Apr 2013, 01:36 PM
Hello,

 The getByUid method doesn't check the ranges of the data source. The ranges contain "raw" data which doesn't have uid set. This is the data returned by the server.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kenny
Top achievements
Rank 1
answered on 26 Apr 2013, 05:48 PM
Actually after going back to double check, when looking at _ranges, the array of objects inside are indeed NOT the "raw" data but the Kendo extended versions. These objects DO have the UID set. 

But I guess my question is answered, the getByUid method only returns what is in the current view (_view) ? 

But based on my poking around it does appear that the data is available in the objects and it should be able to return it to me? 
0
Rosen
Telerik team
answered on 29 Apr 2013, 10:00 AM
Hello Kenny,

Indeed, the getByUid work only on items which are returned by the data method of the DataSource. One should not depend on data which should be in the private ranges, as in future version of the DataSource component the ranges may be cleared more aggressively.

All the best,
Rosen
the Telerik team
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
Kenny
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Kenny
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or