variables in new DataTable
variables in new DataTable
![danbuntu](https://secure.gravatar.com/avatar/a56771324707390b3793f0f95892cc74/?default=https%3A%2F%2Fvanillicon.com%2Fa56771324707390b3793f0f95892cc74_200.png&rating=g&size=120)
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