Data Tables

Data Tables

maddukurisarathmaddukurisarath Posts: 1Questions: 0Answers: 0

Hi Folks

I am trying to insert data into datatables Manually if i am giving data in a object the is loading into datatables grid,but if i am trying to insert the data from an input form the data is not loading int datatables grid please help me out to solve this problem my code is below if you want to review

var dataSet = [
[
    "Tiger Nixon",
    "System Architect",
    "Edinburgh",
    "5421",
    "2011/04/25",
    "$3,120"
],
[
    "Garrett Winters",
    "Director",
    "Edinburgh",
    "8422",
    "2011/07/25",
    "$5,300"
]

]

$(document).ready(function() {

$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>' );

var dt =$('#example').dataTable( {
    "data": dataSet,
    "columns": [
        { "title": "Engine" },
        { "title": "Browser" },
        { "title": "Platform" },
        { "title": "Version", "class": "center" },
        { "title": "Grade", "class": "center" }
    ]
} );

$('#register-form').click(function() {

var vArr = ["Tiger Nixon",
"System Architect",
"Edinburgh",
"5421",
"2011/04/25",
"$3,120"
];

for (i=0;i<5;i++){
vArr.push(document.getElementsByName("txt")[i].value);
}
dataSet.push(vArr);

document.getElementById("data-set").innerHTML = vArr;
console.log(dataSet);

});
} );

This discussion has been closed.