"No Data Message" - sZeroRecords does not appear (Server-Side)

"No Data Message" - sZeroRecords does not appear (Server-Side)

Kai82Kai82 Posts: 4Questions: 0Answers: 0
edited October 2010 in General
Hi,

the sZeroRecords message does not appear, when I make a server-side post.
Otherwise, everything works.

My Json-Data Response is:
{"sEcho":1,"iTotalRecords":0,"iTotalDisplayRecords":0,"aaData":null}

My Code is:

[code]
$('#searchDataTable').dataTable(
{
"oLanguage": {
"sInfoFiltered": "(Seiten: _MAX_)",
"sLengthMenu": "Pro Seite: _MENU_",
"sZeroRecords": "Keine Daten gefunden.",
"sInfo": "Anzeige der Treffer: _START_ - _END_ von _TOTAL_",
"oPaginate": {
"sPrevious": " ",
"sNext": " ",
"sLast": " ",
"sFirst": " "}

},

"sDom": '<"top">rt<"bottom" <"bottom1"il><"clear"><"bottom2"p>><"clear">',
"sPaginationType": "full_numbers",
"bFilter": false,
"bStateSave": true,
"bServerSide": true,
"sAjaxSource": contextPath + "/index.html?action=sort",
"fnServerData": function ( sSource, aoData, fnCallback ) {

$.each(searchForm, function() {
aoData.push({"name": this.name, "value": this.value});
}),

$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"aaSorting": [],
"aoColumns": [
{ "sName": "lfdnr", "bVisible": false },
{ "sName": "lfdnrformat","fnRender": function( obj )
{
sReturn ='

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Try making aaData and empty array rather than null. DataTables always expects an array there.

    Allan
  • Kai82Kai82 Posts: 4Questions: 0Answers: 0
    Hi Allan,

    can you show how a empty array should look like in Json.

    These Json Responses don't work

    {"error":false,"sEcho":0,"iTotalRecords":0,"iTotalDisplayRecords":0,"aaData":[[null,null,null,null,null,null,null,null,null,null,null]]}
    {"error":false,"sEcho":0,"iTotalRecords":0,"iTotalDisplayRecords":0,"aaData":[]}
    {"error":false,"sEcho":0,"iTotalRecords":0,"iTotalDisplayRecords":0,"aaData":[[]]}

    Kai
  • Kai82Kai82 Posts: 4Questions: 0Answers: 0
    Hi Allan,

    with an empty array everything is working now :) (there was an other bug).

    Thanks for help!!!
This discussion has been closed.