How to retrive nextPage?

Could you show an example of retriving nextPage?

http://backendless.com/documentation/data/js/data_basic_search.htm

Hi Anton,

Try this:

var query = new Backendless.DataQuery();
query.options = { pageSize:value, offset:value };
Backendess.Persistence.of( classTableName ).find( query, async );

where:

  • pageSize is how many objects you’d like to retrieve
  • offset is the numerical index of the first object to load data from. If you’re loading next page, this value should be equal to the size of the collection you received in the first request.

Mark

If you make a call to,

Backendess.Persistence.of( classTableName ).find( query, async );

a BackendlessCollection is returned with the results. BackendlessCollection has a “nextPage” method. Can you call this method to retrieve the next page of results for the original query?

Yes, you can:
https://github.com/Backendless/JS-SDK/blob/master/libs/backendless.js#L585-L587

Please keep in mind that the paging mechanism changed in version 4:
https://backendless.com/docs/js/doc.html#data_data_paging

Regards,
Mark

Regarding version 4, how long to we have before you will stop supporting version 3 in Backendless Cloud? An approximate, un-official estimate will totally suffice.

Also, lets say you load a VideoFeed object that has a one-to-many relation called “featuredVideos” to a Video table. The documentation says if you click the autoload checkbox, then it will load “all” of the associated objects in the relation. However, given our chat on a separate thread, I am assuming that it will only load the first 100 objects, not “all” of them if there are thousands for example.

So, lets say I have a VideoFeed object modeling the VideoFeed table, and a Video object modeling the Video table in my Swift iOS app. If I fetch a VideoFeed object from the server, it puts the videos into a Swift array of “Video” objects, not into a BackendlessCollection. In that case, do I need to make a separate query to get additional pages?

Version 3.x will run side-by-side with 4.x as long as there are paying customers on 3.x. As for bug fixes and patches, we will be giving priority to those in 4.x. What that means is any problems reported in 3.x will be checked if they exist in v4 and fixed there.

Regards,
Mark

In version 3.x the backend will return all related objects if you have auto-load turned on. The autoload as a feature is not recommended to use in production deployed apps, it is convenient for development, you do not need to write any extra code to get relations, but it is terrible for performance.

The complexity of the generated queries is rather high and the time it takes to get all the data is detrimental not just for your app, but the backend in general. This behavior is changed in version 4 - in there any related objects are returned paged.

Regards,
Mark