APIs & Integrations

giozua
Contributor | Platinum Partner
Contributor | Platinum Partner

Pagination in hubdt table

Hi all,
is there a way to make pagination working with hubdb tables?
I am developing a calendar of events and i would like to show 5 rows per page so i would like to have a pagination.
I’ve try to insert in queryparam a “posts_per_page=5” (like in wp_query of wordpress) but it give me an error
Someone can help me how can I insert a pagination?
Thanks

Giovanni

0 Upvotes
4 Replies 4
dcronk
Participant

Pagination in hubdt table

So, you’re saying there is no dynamic way to do this and you have to manually create pages that each house their own query? Ugh, that’s just silly.

0 Upvotes
giozua
Contributor | Platinum Partner
Contributor | Platinum Partner

Pagination in hubdt table

Ok I’ve this
{% set queryparam = “&orderBy=-event_date” %}
and it should became this
{% set queryparam = “&orderBy=-event_date&limit=5&offset=0” %}
but how can I change it for the second page? This is the queryèaram for all resuts

Giovanni

0 Upvotes
zwolfson
HubSpot Employee
HubSpot Employee

Pagination in hubdt table

When you want to grab the second page, all you have to do is change the offset param to 5 instead of 0 to grab the next 5 results.

0 Upvotes
zwolfson
HubSpot Employee
HubSpot Employee

Pagination in hubdt table

Hi @giozua,

To page through the rows of HubDB table you would use both the offset and limit parameters documented here: https://developers.hubspot.com/docs/methods/hubdb/get_table_rows

So for the first page, you would offset=0&limit=5, then for the second page of results you would request offset=5&limit=5.

-Zack

0 Upvotes