Dynamically change bPaginate value
Dynamically change bPaginate value
Hi all,
Kind of a Datatables-newbie here, so bear with me... I was able to set up multiple tables on my page and it is working quite nicely, but there's one thing I just can't seem to get working.
I populate my tables with an external data source and I want to turn the pagination feature on or off based on the number of records that is currently showing, but it doesn't work. Here's my code (table4_3 is a table object, options4_3 contains the data that was used to populate the table, among other things):
[code]
var oSettings = table4_3.fnSettings();
oSettings.bPaginate = (options4_3.series[0].data.length>10);
table4_3.fnDraw();
table4_3.fnAdjustColumnSizing();
[/code]
I searched for similar questions on these forums (and elsewhere), but couldn't find a solution. I also tried with an underscore before bPaginate, but that didn't work either...
Any help is appreciated.
Kind of a Datatables-newbie here, so bear with me... I was able to set up multiple tables on my page and it is working quite nicely, but there's one thing I just can't seem to get working.
I populate my tables with an external data source and I want to turn the pagination feature on or off based on the number of records that is currently showing, but it doesn't work. Here's my code (table4_3 is a table object, options4_3 contains the data that was used to populate the table, among other things):
[code]
var oSettings = table4_3.fnSettings();
oSettings.bPaginate = (options4_3.series[0].data.length>10);
table4_3.fnDraw();
table4_3.fnAdjustColumnSizing();
[/code]
I searched for similar questions on these forums (and elsewhere), but couldn't find a solution. I also tried with an underscore before bPaginate, but that didn't work either...
Any help is appreciated.
This discussion has been closed.
Replies
If you want to hide the pagination control when there are less than 10 rows, I'd suggest you use fnDrawCallback and manipulate the `display` property of the pagination element.
Allan
Is it maybe possible to do it by re-generating the entire datatable, ie call dataTable() again ?
Thanks, Allan!
Allan