Behseini
Behseini

Reputation: 6330

Having Issue On Loading Array Items Into jQuery DataTable

Can you please take a look at This Demo and let me know why I am not able to load the data from the array into the DataTable instance correctly?

Here is the code which I have:

var data =  [ "Dai Rios", "Personnel Lead", "Edinburgh", "2290", "2012/09/26", "$217,500" ];
var tbl = $('#example').DataTable();
$("#load").on("click", function(){
     tbl.rows.add(data).draw();
});

Upvotes: 2

Views: 58

Answers (2)

Shameem Ahmed Mulla
Shameem Ahmed Mulla

Reputation: 666

There is slight mistake in you script

$("#load").on("click", function(){
  tbl.row.add(data).draw();

});

you had it rows instead of row.

Upvotes: 2

Snehal S
Snehal S

Reputation: 875

instead of "rows" in tbl.rows.add(data).draw(); use "row" i.e.

instead of

tbl.rows.add(data).draw();

use

tbl.row.add(data).draw();

Upvotes: 1

Related Questions