Truncate items on last page of RG

Hi there,

I am trying to implement pagination on an RG following the tutorial of @romanmg.

So far so good. But now I want to only show the left over items on the last page (whitout the previous records). Using a workflow I change the datasource of the RG to show items from a specific number. This works but then my pagination is broken because it is set back to only one page.

How should I change the source of the RG to only show from a specific item number on the last page, but at the same time preserving my pagination below the RG?

Thanks

Below some screenshot to clarify the problem I am facing (please ignore the spacing between the RG items):

Page 1

Page 2

Page 3 (Last page)
Problem: Page numbers are reset to 1.

There are a lot of things you can do on bubble with custom states. Custom states have been something for me that opened up a whole new level of abilities on Bubble. I believe this link may be of some help

It provides some ideas of how to create a really good pagination effect. Main idea is to set data source to show items from until and utilize the custom states to represent the numbers from and until.

Then need to add some more custom states to do the math involved to always have the correct number of items shown on each page. As you get to the last page you will be left with the final items displayed.

Your real issue I assume is in the numbers list for pagination…this also may require some custom states to set those up the correct way.

You can do some fancy work on the pagination to automatically change as well using some workflows to scroll to the page number you are looking for.

Another nice feature is the “current cell’s index” which is basically a number ( like a sort number )…utilizing that in your pagination can keep things together as well.

@romanmg came up with a solution for me that worked. I can’t remember all of the details but something about dividing the number of records by the number of records per page. using this you can determine the last page, which I think you need for a custom state. That calculation also enables you to determine the start record # using the number of pages rounded down times the number of records per page plus 1.

So if you have 611 records and there are 30 per page, 611 / 30 = 20.367 So you round down to 20. Then 20 x 30 = 600 +1 = 601 which is the record number to start on for the “last page”

Thanks All. I solved it searching other posts on this forum. I made an error in configuring the list of numbers plugin. I used the RG list of companies, but it needed to be do a search for companies…

Another question. What is performance wise the best option when the dataset becomes larger:

Just go to a specific page of a repeating group or display items from and until a specific item number, which both are calculated based on the selected page number?