variables in new DataTable
variables in new DataTable
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
This discussion has been closed.
Answers
Please explain what you mean when you say outputted.
Using the form
bPaginateis from Datatables 1.9 and is deprecated. Datatbles uses camel case notation now. See the conversion doc.bPaginateis now thepagingoption. This particular option takes a boolean parameter not a string.See this test case demonstrating setting the
pagingparameter, via a variable, totruefor the first table andfalsefor the second table:https://live.datatables.net/hujobino/1/edit
Kevin