Adding a skip to page function
Adding a skip to page function
mcaninchr
Posts: 3Questions: 1Answers: 0
Good evening. We implemented paging and filters but our end users want a jump to button with a text box. I would think that this should be straight forward but I cannot seem to find the method call the page number buttons are using to try and manually invoke and supply a user entered page number. Can anyone point me in the right direction? This I am sure has been solved many times before.
Thank you for your help.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Will this help:
https://datatables.net/plug-ins/pagination/input
Kevin
That you for the response. It is hard to say how much this will help. The example doesn't really illustrate much. All I want to do is augment what is there. There seems to be a lot of additional code
Well, its pretty easy to build a demo. Put one together for you to try:
http://live.datatables.net/molosefo/1/edit
Kevin
Can't disagree with that. The paging plug-in API isn't perfect at the moment. Basically you need to replace the entire control. That is something that will be resolved in the next major version (although I wouldn't wait for that to be released - I don't really expect it to happen until early next year).
Allan
I appreciate all the help and will look over the demo some more but at first glance it takes out the existing numbering and replaces it with the jump to box. I have been asked to keep the original numbering and add the jump functionality as well. It seemed to me that it should be as simple as determining what method is called when somebody clicks on one of the paging items (numbers, previous, next) and just calling that method directly but passing in the value of the text box to set the page. If I could do that it seems to me that the existing grid code should work perfectly. Thank you.
If you want to keep the existing paging and are happy to basically have a patch over the top - I'd suggest using the
draw
event to insert your input element into the pagination control, and keep it at the correct value (page.info()
).Allan