variables in new DataTable
variables in new DataTable
danbuntu
Posts: 11Questions: 2Answers: 0
I'm trying to use a varible when defining my datatable options. This is to allow me to change is dynamically.
I have the following test case:
<code>
var paging = 'testttt';
let table = new DataTable('#resultstable', {
bPaginate: paging
});
</code>
When this is outputted it's printing bPaginate: paging rather then bPaginate: testttt
Answers
Please explain what you mean when you say outputted.
Using the form
bPaginate
is from Datatables 1.9 and is deprecated. Datatbles uses camel case notation now. See the conversion doc.bPaginate
is now thepaging
option. This particular option takes a boolean parameter not a string.See this test case demonstrating setting the
paging
parameter, via a variable, totrue
for the first table andfalse
for the second table:https://live.datatables.net/hujobino/1/edit
Kevin