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

Issue with data source range() method

1 Answer 82 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Brian Roth
Top achievements
Rank 1
Brian Roth asked on 10 Apr 2014, 11:18 PM
I'm working on a custom widget that uses the kendo data source's prefetch() and range() methods to work something like the virtual scrolling option for the Grid widget. Getting range 0 - 10 works as expected, but I am running into a problem when I try to retrieve the next range (10 - 20).  The data source seems to be skipping ahead another page.  The range returned by view() is the correct one (10 - 20), however the skip() method returns 20 instead of 10:

var skip = 0,
    take = 10;
 
dataSource.range(skip, take);
dataSource.skip(); // 0
dataSource.take(); // 10
 
dataSource.range(skip + take, take);
dataSource.skip(); // 20
dataSource.take(); // 10

Is it by design that the data source automatically configures the skip and take to always return the next range? If not, I believe the cause of the issue is on line 7809 of kendo.all.js. I am currently using "Kendo UI Complete v2014.1.321".

// size = skip + take
// Using size in math.min() will always set that._skip to the start of the next range if we're "paging" forward
that._skip = skip > that.skip() ? math.min(size, (that.totalPages() - 1) * that.take()) : pageSkip;


There does not seem to be any documentation for the range(), prefetch(), inRange(), etc. online.  Are these methods intended only for internal use by the framework or are they officially supported features of the data source?  This is a really awesome feature of the data source, and I hope I can count on it in future versions!

Thanks!
Brian

1 Answer, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 14 Apr 2014, 02:44 PM
Hello Brian,

Indeed these methods are not documented because they are intended for internal usage and using them is not something that we support. If you find them useful and you think they should be added to the framework officially, share it as an idea on the feedback portal where more people can vote for it.

http://feedback.kendoui.com/

I am sorry for any inconvenience caused.

KInd Regards,
Petur Subev
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 Roth
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or