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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -