api.page(n) doesn't work
api.page(n) doesn't work
Hi all, I have created this demo: http://live.datatables.net/papiwilo/1/edit ; in it, in the preInit.dt event, I set api.page.len(5)and it works, but api.page(2) doesn't work. Any ideas?
This discussion has been closed.
Answers
The
preInitevent occurs before the data is loaded. You are probably better off using theinitevent. For example:http://live.datatables.net/cipoguku/1/edit
Additionally you will need to use
draw()with thepage()change. And either use thefalseor"page"draw() parameter to stay on the current page.Kevin
Thanks @kthorngren , but the
initmethod is called after the data is loaded. What I want is to set the initial page to be loaded, without the need to make a second ajax call, that would happen if I usepage()anddraw()methods.Oh, you are using server side processing and want to set the start page?
If so maybe @colin 's last example in this thread will give you some ideas:
https://datatables.net/forums/discussion/comment/142868/#Comment_142868
Kevin