Developer forum

Forum » Templates » Invoice pagination

Invoice pagination

Alex Guo
Reply

Hi all,

We've customized invoicelist.cshtml to include additional filtering based on custom data from Business Central, specifically using the ICC_filterCompletelyPaid property to filter whether invoices are paid or not.

/Files/Templates/Designs/Swift/eCom/IntegrationCustomerCenter/InvoiceDetails.cshtml

The filtering itself is working fine, but we're running into an issue with pagination. The pagination logic currently looks like this:

This is designed to calculate the total number of pages based on all invoices, not just the filtered ones.

 

/Files/Templates/Designs/Swift/eCom/IntegrationCustomerCenter/CustomerCenterPagination.cshtml

var customerCenterPages = GetLoop("Ecom:IntegrationCustomerCenter.Paging.Pages");
//rest of code


// uses customerCenterPages.Count() aka all pages
@foreach (var trunkPage in GetTruncatedPagination(currentPageNumber, customerCenterPages.Count()))
{

}

 

Question:

How can we adjust or replace this logic so that it only counts and paginates the filtered invoices?

Any pointers or examples would be greatly appreciated!

Thanks in advance,


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

HI Alex,
can you consider implementing the filtering on the BC side by implementing own extension that will filter and pass only the needed orders?
The sample answer was in this post: https://doc.dynamicweb.com/forum/integration/integration/need-filtering-of-data-and-custom-fields-response-from-business-central.
BR, Dmitrij

 

You must be logged in to post in the forum