Can you pass an array to the order table initialization?

Can you pass an array to the order table initialization?

gbutlergbutler Posts: 2Questions: 1Answers: 0

Using 1.10.4. I'm trying to pass an array to the order parameter in the table initialization. If I hard code it, it works fine. But I'm building the array from a combination of querystring parameters so the sort order can be changed at runtime. I'm a bit of a Noob, so hoping I'm just missing something simple.

//works work
"order" : [[0,'asc'],[1,'desc']]

//fails
tablesort=[];
tablesort.push([0,'asc']);
tablesort.push([1,'desc']);

var theresults=$('#example').dataTable( {
...,
"order" : tablesort,
...
}

//also fails
theresults.order(tablesort);
thereuslts.draw();

This discussion has been closed.