How to display column from javascript array Mixed with js dataSource inside Jquery Datatables
How to display column from javascript array Mixed with js dataSource inside Jquery Datatables
kiran7881
Posts: 6Questions: 3Answers: 0
I have got a local JSON flat DataSource as shown below
var dataSet = [
[
"481.55",
"10.40"
],
[
"561.30",
"-2.55"
],
[
"368.20",
"33.45"
]
];
And i am using Jquery Datatables to display Data in tabular format this way
$(function()
{
$('#example').dataTable( {
"data": dataSet,
"columns": [
{ "title": "Price" },
{ "title": "Volume" }
]
} );
})
This is my jsfiddle
http://jsfiddle.net/cv04pp37/9/
With this the data is shown in this way
Price Volume
368.20 33.45
481.55 10.40
561.30 -2.55
I have got a javascript array as shown below where the first value refers to first value of the dataSet array and so on
var array_names =['ONE','TWO','THREE'];
My question is , Is it possible to display One more additional column Name in Jquery Datatables so that it looks like this
Name Price Volume
ONE 368.20 33.45
TWO 481.55 10.40
THREE 561.30 -2.55
This discussion has been closed.
Answers
I was trying this way http://jsfiddle.net/cv04pp37/13/
With this fiddle http://jsfiddle.net/cv04pp37/13/ , i am always getting only the first value from the array