Requested unknown parameter '0' from the data source for row 0
Requested unknown parameter '0' from the data source for row 0
chucke1992
Posts: 8Questions: 0Answers: 0
I'm using array of objects - convert list of objects using GSON. In debug console it looks like this
[code]
{ "aaData" : [
{ "email":"EEE", "login": "log1", "password" : "a235123151312", "id" : 1 },
{ "email":"EEE", "login": "log2", "password" : "a235123151312", "id" : 1 }
]}
[/code]
my datatable looks like this
[code]
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');
}
});
}
});[/code]
with html
[code]
Email
Login
Password
ID
[/code]
but I've got an error - [quote]DataTables warning (table id = 'usertable'): Requested unknown parameter '0' from the data source for row 0[/quote] 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
[quote] how to ignore a column - for example password[/quote]
[code]
{ "aaData" : [
{ "email":"EEE", "login": "log1", "password" : "a235123151312", "id" : 1 },
{ "email":"EEE", "login": "log2", "password" : "a235123151312", "id" : 1 }
]}
[/code]
my datatable looks like this
[code]
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');
}
});
}
});[/code]
with html
[code]
Login
Password
ID
[/code]
but I've got an error - [quote]DataTables warning (table id = 'usertable'): Requested unknown parameter '0' from the data source for row 0[/quote] 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
[quote] how to ignore a column - for example password[/quote]
This discussion has been closed.
Replies
Just don't include it int he HTML or JS :-).
> DataTables warning (table id = 'usertable'): Requested unknown parameter '0...
Can you run the debugger over the table please: http://debug.datatables.net .
Allan
I see. Thanks!
[quote]Can you run the debugger over the table please: http://debug.datatables.net .
[/quote]
Well the problem solved itself lol. I've restarted server several times - and now it works.