Datatables if table is paginated?
Datatables if table is paginated?

Apologies if this is somewhere obvious but I definitely looked.
How would I check to see the boolean value of my table paging option?
IE
(if table.paging == true) {
do something
}
Thanks!
This discussion has been closed.
Answers
Did some more searching, maybe this works but its not exactly what I want
//only one page equals no pagination? Not always the case...
if (table.page.info().pages === 1) {
do stuff
}
Looks like the
length
property ofpage.info()
is the one to use. It returns-1
if paging is turn off. It will also return-1
if paging is on but the pageLength is set to-1
, effectively turning paging off. You can see this in this example:http://live.datatables.net/pojepiri/2/edit
Comment out
paging: false
and uncommentpageLength: -1
. Might be better ways to do this.You could use the
settings()
API to get the settings object. This is not recommended as the settings object may change from version to version.Kevin
Thanks Kevin, I did compare with paging on / off and was getting the same value as -1. But that was with only one page, so I will use that as my condition, thanks again!