DataTables warning (table id = 'lesec'): Requested unknown parameter '4' from the data source for ro

DataTables warning (table id = 'lesec'): Requested unknown parameter '4' from the data source for ro

giogio88giogio88 Posts: 3Questions: 0Answers: 0
edited April 2012 in DataTables 1.9
Hello Allan,

my problem is that the return data server can not handle them and prevent them from being displayed in the table, as they must be given of detail visible only when appropriate.

Error :DataTables warning (table id = 'lesec'): Requested unknown parameter '4' from the data source for row 0

code:
var oTable;
$(document).ready(function() {
oTable = $("#lesec").dataTable({
"oLanguage": {
"sLengthMenu": "Mostra _MENU_ righe per pagina",
"sZeroRecords": "Nessun elemento trovato",
"sInfo": "Mostrate le righe da _START_ a _END_ di _TOTAL_ righe totali",
"sInfoEmpty": "0 righe totali",
"sInfoFiltered": "(filtrate da _MAX_ righe totali)",
"sSearch": "Cerca",
"oPaginate": {
"sFirst": "Prima",
"sLast": "Ultima",
"sNext": "Successiva",
"sPrevious": "Precedente"
}
},
iDisplayLength:20,
iDisplayStart:20,
sPaginationType:'full_numbers',
"bServerSide": true,
"sAjaxSource": "${data.request.contextPath}/ajax/getDetails.jsp",
"fnServerData": function ( sSource, aoData, fnCallback ) {
jQuery.ajax({
"type": "GET",
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource,
"data": aoData,
"cache": false,
"success": function (msg) {
//oTable.fnDraw(false);
fnCallback(msg);
},
"error" : function(XMLHttpRequest, textStatus, errorThrown) {
if ( error == "parsererror" ) {
alert("Errore di parsing json" + ": " + errorThrown);
}else{
alert("Errore ajax: "+ XMLHttpRequest + ": " + textStatus + ": " + errorThrown);
}
}
})
}
});


//close ready
});

//html



Priorita'
Accettazione
Data
Tipo
Reparto




1
564230213
2012/02/10
ACCETTATA
RAD


1
564230213
2012/02/10
ACCETTATA
RAD


1
564230213
2012/02/10
ACCETTATA
RAD


1
564230213
2012/02/10
ACCETTATA
RAD

Replies

  • giogio88giogio88 Posts: 3Questions: 0Answers: 0
    I do not manage the json data. Help me!
  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    What is the JSON that is being returned from the server?

    Allan
  • giogio88giogio88 Posts: 3Questions: 0Answers: 0
    Thank you :)
    The json is correct, I checked on http://jsonlint.com/ and this is

    {"iTotalDisplayRecords":131,"iTotalRecords":50,"aaData":[[50,"ECOGRAFIA DEGLI ARTI SUPERIORI O INFERIORI O DISTRETTUALE ARTERIOSA","ECOGRAFIA","ACCETTATA"],[35,"MONITORAGGIO ELETTROCARDIOGRAFICO","CARDIOLOGIA","ACCETTATA"],[36,"ECODOPPLERGRAFIA CARDIACA","CARDIOLOGIA","ACCETTATA"],[37,"CLISMA CON DOPPIO CONTRASTO","RADIOLOGIA TRADIZIONALE","ACCETTATA"],[37,"ALTRA RADIOGRAFIA DI COSTE STERNO E CLAVICOLA","RADIOLOGIA TRADIZIONALE","ACCETTATA"],[10,"ECOCOLORDOPPLERGRAFIA CARDIACA","CARDIOLOGIA","ACCETTATA"],[12,"ECOCOLORDOPPLERGRAFIA CARDIACA","CARDIOLOGIA","ACCETTATA"],[30,"ECOCOLORDOPPLERGRAFIA CARDIACA","CARDIOLOGIA","ACCETTATA"],[30,"MONITORAGGIO ELETTROCARDIOGRAFICO","CARDIOLOGIA","ACCETTATA"],[70,"ECOGRAFIA DEI TESTICOLI","ECOGRAFIA","ACCETTATA"]],"sEcho":1}
  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    Its valid JSON sure, but you've only got 4 elements per row, and 5 columns in the table - hence when DataTables looks for column 5 (index 4) it isn't there in the JSON and you get the error.

    Allan
This discussion has been closed.