Pagination with Api Call
Pagination with Api Call
Alraune
Posts: 1Questions: 1Answers: 0
I'm using an API (which i dont have access to develop) and the API return results paginated by page number and quantity per page i read a lot of articles with server side pagination but dont find a way to implement it.
Can anyone give me a hand?
My Api return
public class PageRoot
{
public List<Results> results { get; set; }
public int currentPage { get; set; }
public int perPage { get; set; }
public int totalPages { get; set; }
}
and i want to paginate the list of results.
This discussion has been closed.
Answers
You would need to use the
ajax.data
option as a function and modify the parameters that DataTables is sending to the server to what the API is expecting. You would also need to modify the return from the server (usingxhr
to modify the JSON data returned from the server to match what DataTables expects.The server-side processing manual page has details of what is expected.
Allan