Detect "Next", "Previous" button
Detect "Next", "Previous" button
jc0966
Posts: 9Questions: 2Answers: 0
I am using Datatables 1.10 with server-side pagination and pagingType "simple.
So only the "Next" and "Previous" pagination buttons are displayed.
How can I determine which of these buttons is clicked?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
When DataTables makes the request to the server, the information it sends will contain everything the server needs to know about what data to gather. You don't need to explicitly know which button was clicked on.
Allan
Hi Allan,
I need to do some processing on the client side before sending the request to the server.
So I need to know if the user clicked the "Next" or "Previous" button. The processing is different based on whether it was "Next" or "Previous".
Effectively (in pseudo-code)
send-request-to-server
You could use the
ajax.data
option and check what thestart
property is (see the server-side documentation. That's really the only way to see what page of data the DataTable is going to request. You would need to store the previous value to check to see if the new start point is greater or less than the previous.Allan
Yes, I was going down the path of storing the previous "start" and comparing it with current when I posted the question because I thought there might be a better way.
This post can be closed.
Thanks.