javascript - Warning: Requested unknown parameter '0' for row 0 -


i have following code:

var dummydata = {     "activities": [         { "date": "19/06/2015 19:00", "user": "dan", "display": "first item" },         { "date": "19/06/2015 19:00", "user": "andrew", "display": "second item" },         { "date": "19/06/2015 19:00", "user": "trevor", "display": "third item" },         { "date": "19/06/2015 19:00", "user": "bob", "display": "fourth item" }     ] };  $("#sysacttable").datatable({     "data": dummydata.activities,        }); 

i have tried several variations getting error points this page. html follows:

<table id="sysacttable" class="table table-hover" style="margin-bottom:0px">                         <thead>                             <tr>                                 <th style="width:20%">date</th>                                 <th style="width:30%">user</th>                                 <th style="width:50%">display</th>                             </tr>                         </thead>                         <tbody>                             <tr>                                 <td style="width:20%"></td>                                 <td style="width:30%"></td>                                 <td style="width:50%"></td>                             </tr>                         </tbody> 

again have tried number of varieties. why getting error below?

datatables warning: table id=sysacttable - requested unknown parameter '0' row 0

the problem data array of objects. default, datatables expects data array of arrays.

you need use columns.data option describe data structure.

$("#sysacttable").datatable({     "data": dummydata.activities,     "columns": [        { "data": "date" },        { "data": "user" },        { "data": "display" }     ] }); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -