Using ServerSide to Call PAGED Api
Using ServerSide to Call PAGED Api
timcadieux
Posts: 76Questions: 22Answers: 0
So I have to get content from an existing API. The API takes 2 params, From and Take
They also return the TOTAL Records in a header and so I'm attempting to get the Paging to work with this...
I've used the code below but it only displays the current 10 records..
Anyone have a suggestions as to how i can get this to work and an API that is already paged?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi timcadieux,
Take a look at the following documentation.
The
preXhr
event occurs before Datatables makes an ajax request to the server. On this event you are able to access thedata
parameter and adjust it's values accordingly to your own needs, before making a request for the data from the server.I think you want to set your
from
andtake
properties based on thestart
andlength
properties within the sent parameters of the server side processing object.You then also need to use the
xhr
event to modify the data that the server is returning into the format that datatables is expecting.Hope this helps,
Sandy
Something along the lines of the following
Sandy, I hate to say, but i dont follow?
oh wow, I feel like a moron.
I was able to get it to work like so