How can I disable Paging Dynamically?
How can I disable Paging Dynamically?
Geoff_Olding
Posts: 4Questions: 2Answers: 1
Hello there.
I am able to disable paging by using the following code:
$('#geoffstable').dataTable({
"paging": false
});
However, I would like to be able to disable it dynamically, e.g. if there is only one page.
I want to do something like:
$('#geoffstable').dataTable({
"initComplete": function (settings, json) {
if ( onePage() ) {
var api = this.api();
api.paging = false;
}
});
This code is wrong, however hopefully it demonstrates what I am trying to do.
Any help greatly appreciated.
Geoff Olding
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @Geoff,
You can't disable the paging after the initialisation. I assume you want to get rid of the page controls, so you can be sneaky and just hide them with a jQuery command:
Live example here.
Cheers,
Colin
You might be interested in this plug-in.
It doesn't disable the paging feature as such, but it does hide the UI element from the end user so it looks like it is disabled.
Allan
Many thanks