Forum Discussion

gatomonstruo's avatar
4 years ago

Custom Pagination not working

 

Hey Guys, 

Before start, I've reading all the pagination related posts but I'm not able to find the solution for the issue that I'm having.

So, I'm here again asking for some guidance. 

 

I'm customizing a 'latest posts' page for our community and I want to implement the pagination widget, but i don't know why isn't being shown on the page. 

 

The code 

 

<#assign pageSize = settings.name.get("layout.messages_per_page_linear")?number/>
<#assign pageNum = webuisupport.path.parameters.name.get("page", 1 )/>
						<#assign pageable_item = webuisupport.paging.pageableItem.setCurrentPageNumber(pageNum).setItemsPerPage(pageSize).setPagingMode("enumerated").build />
						<@component id="common.widget.pager" pageableItem=pageable_item />

 

I'm sure i'm missing something but I don't know what is it. Any guidance will be appreciated. 


Thanks in advance. 

Regards, 

 

  • gatomonstruo,

    After looking at your code, looks like you are also missing property for .setTotalItems(total_articles?number) in below code.

    <#assign pageable_item = webuisupport.paging.pageableItem.setCurrentPageNumber(pageNum).setItemsPerPage(pageSize).setPagingMode("enumerated").build />

    Your code should be like

    <#assign pageable_item = webuisupport.paging.pageableItem.setCurrentPageNumber(pageNum).setItemsPerPage(pageSize).setTotalItems(total_posts?number).setPagingMode("enumerated").build />

    Where "total_posts" should be the total count of the posts in the API results.