Hi I am displaying data in the table from REST API. API supports pagination.

{
    "pageNumber": 1,
    "pageSize": 10,
    "prevPage": null,
    "nextPage": 2,
    "maxPage": 5,
    "itemType": "",
    "pageItems": 10,
    "totalItems": 47,

}

I was able to successfully implement the pagination. It's working perfectly fine beside one thing. Sometimes when I refresh the page I get "Cannot assign a JavaScript number with value NaN to an output parameter of type Integer Check the JavaScript node 'GetToltalPages' of the action 'InitPagination".

Please help me with this Issue.

Thank you for your time. :)


Hey Nannu, can you share a screenshot, especially the REST API you are using. Is this an external API that you built a library around?

Are you building in Traditional Web or Reactive Web? 

Hi Nannu,

Good morning!

Can you please ellaborate further?

My I assumption for now is why not convert the JSON result to a RecordList so it can be paginated smoothly.

Thank you and kind regards,

Chris

Hello Nanu,

You are passing NaN (Null value) to an Integer output parameter in your javascript code (inside action InitPagination). So you got that error.

Can you please share your Javascript code that you have in action InitPagination? Focus when you call 'GetToltalPages' please.


BR,

Luis

Thank you all for your reply.

1. I am using reactive app and it's an external API.

2. I am actually assigning values to the pagination variables from my API structure(Because API supports pagination). And pagination is working perfectly fine.

.3. I didn't right any JavaScript code. Action InitPagination is a part of pagination component. It's under outsystemsUI > Pagination > InitPagination.


Thank you.

Looking forward to your reply.

Hi Nannu 

Can you confirm if you are setting all the correct values as is described in documentation?

Can you validate if you are not passing 0 in TotalCount?


BR,

Luis

Luís Cardoso wrote:

Hi Nannu 

Can you confirm if you are setting all the correct values as is described in documentation?

Can you validate if you are not passing 0 in TotalCount?


BR,

Luis

Hi Luis,

I am assigning TotalCount = 

GetAllSecurityRoleMembers.Out1.Payload.TotalItems

and my API  response is:

"payload": {
    "pageNumber": 1,
    "pageSize": 10,
    "prevPage": null,
    "nextPage": null,
    "maxPage": 1,
    "itemType": "Sec",
    "pageItems": 5,
    "totalItems": 5

}


Also I am getting right count in the pagination just don't how can I debug this issue.

Thank you for your time. I really appreciate it.