Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all articles
Browse latest Browse all 1816

Requested unknown parameter '0' from the data source for row 0

$
0
0
I'm using array of objects - convert list of objects using GSON. In debug console it looks like this
{ "aaData" : [ 
      { "email":"EEE",  "login": "log1", "password" : "a235123151312", "id" : 1 }, 
      { "email":"EEE",  "login": "log2", "password" : "a235123151312", "id" : 1 }
 ]}
my datatable looks like this
var oTable1 = $('#usertable').dataTable({
        "sPaginationType": "bs_full",
        "bProcessing" : true,
        "sAjaxSource" : "/loadusers.html",
        "aoColumns": [
                      { "mData" : "email" },
                      { "mData" : "login" },
                      { "mData" : "password" },
                      { "mData" : "id" }
         ],
         fnRowCallback: function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
            $(nRow).on('click', function() {
              if ($(nRow).hasClass('info')) $(nRow).removeClass('info');
              else {
                    var arr = oTable1.fnGetNodes();
                    for (var i = 0; i < arr.length; i++) {
                          if ($(arr[i]).hasClass('info')) $(arr[i]).removeClass('info'); //one row per time
                    }
                    $(nRow).addClass('info');
                   }
              });
         }
    });
with html
<table class="datatable table table-striped table-bordered" id="usertable">
                            <thead>
                                <th>Email</th>
                                <th>Login</th>
                                <th>Password</th>
                                <th>ID</th>
                            </thead>
                            <tbody></tbody>
                        </table>

but I've got an error -
DataTables warning (table id = 'usertable'): Requested unknown parameter '0' from the data source for row 0
and it shows several rows but without any data.

P.S. An interesting thing - when I move ajax to .txt and read it using example with deep.txt - it works correctly


Also a question
how to ignore a column - for example password

Viewing all articles
Browse latest Browse all 1816

Trending Articles