[Resolved] Backendless paging


#1

Hai @markpiller and @wade.

How to implementation data paging in dropsource?

https://backendless.com/docs/rest/data_data_paging.html

I found a post from @seanhoots

but I’m not sure whether it can be applied in backendless.

Thanks


#2

Hi @Mieyaa,

Yes, Backendless supports data paging. It is the same API call you make now to fetch data objects. The only difference is you’d need to work with the offset and pageSize parameters of the API call:
Editor%20-%20Dropsource%202019-05-09%2012-53-05

The pageSize controls how many objects should be returned. You can set it up to 100 objects. The offset controls the index from which to load the data. For example, the very first object has offset 0. If you loaded 100 objects, to load the next 100, you need to set the offset to 100, which means “load the next page from index 100”.

Hope this helps.

Mark


#3

I have implemented it. but how to apply it like this diagram.

1 request = 5 object
when I scroll down there is a second request.


#4

Bind the offset parameter to a variable. When the user scrolls the page and gets to the bottom, update the variable (increase the offset) and make the API call.


#5

I will try, thank you


#6

Hi @markpiller, how do detect the user has scrolled to the bottom of the list.
I can’t seem to find any element in dropsource that has such an event.
Do you know of any workaround.
Thanks


#7

The simplest workaround is to add a button at the bottom saying something like Load More. I do not see any events triggered by user scrolling any kind of container, so another workaround would be to handle it directly in the downloaded code for your app.


#8

Thanks Mark, I like the “load more” approach.
Will think about how to even add such a button.
Your second suggestion will probably be the best way but I’ve learnt from experience to if possible avoid building in dropsource and adding code. It makes your development workflow so tedious as any small change you make in dropsource you have to go back and redo things in code.
Thanks for the suggestions.


#9

Great collaboration on this item. I agree on the load more button updating a variable to adjust the offset and pagesize is definitely a good direction there. Thanks @markpiller and @seanhoots for bringing your insights in. I also agree that if you stay away from requiring this feature to need any manual coding on your end into your source code, you’ll save that additional step with each update too.