Is it possible to add specific parameters to the pagination? Example in the comments
Is it possible to add specific parameters to the pagination? Example in the comments
So I have the following issue:
Currently I can make the pagination work doing the following:
I have a "request" with 100+ items coming from my backend and I can make the pagination work fine with just adding the datatable and setting "paging: true".
However bringing 100+ items at once seems a little overpowered so I made the following change to the request:
'MYURL/?skip=0&take=10'
So now, skip is my page and take is how many items I want from that page.
Can I with Datatables itself find a way to add the parameters to the buttons? How do I do that? I've been reading the documentation but there are so many things that I can't figure out a way to implement that?
For example, with each "Next" the 'MYURL/?skip=0&take=10' jumps to 'MYURL/?skip=1&take=10' ,
How does it works?
Answers
100+ rows shouldn't be a problem. Do you see performance issues with the page?
Datatables provides a server paging solution called Server Side Processing. See the SSP docs and the SSP protocol for more details. Its a bit more complicated than sending the page and number of rows. The response needs to contain recordsTotal and recordsFilter information to properly display the paging buttons. Also the protocol supports searching and sorting at the server.
If you create a solution that just returns the rows for the page without server side processing (meaning the Datatable will be client side processing) then Datatables will only see the rows returned and sorting and searching will only take place those rows at the client.
Kevin
For better context of what I am working on:
That would result in both DataTables and Angular attempting to control the same DOM elements. That isn't going to end well for either! You would be better using
data
and feeding theproducts
array in there so just DataTables can control the DOM for its table.Allan