JSFiddle - React, Tailwind, and code Playground
by Rajesh Kumar Boora
HTML
<script src="https://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<table id="example">
<th class="hidden-480">Price</th>
<th class="hidden-480">Volume</th>
<th class="hidden-480">Volume</th>
</table>
JavaScript
var dataSet = [
[
"481.55",
"10.40"
],
[
"561.30",
"-2.55"
],
[
"368.20",
"33.45"
]
];
var array_names =['ONE','TWO','THREE'];
for(var key in dataSet) {
if(dataSet.hasOwnProperty(key)) {
//dataSet[key].unshift(array_names[key]);
dataSet[key].splice(0,0,array_names[key]);
}
}
$(function()
{
$('#example').dataTable( {
"data": dataSet,
"columns": [
{ "title": "Name" },
{ "title": "Price" },
{ "title": "Volume" }
]
//"columns": [
// { data: 0 },
// { data: 1 },
// { data: 2}
// ]
} );
})