Setting sZeroRecords Breaks sProcessing

Setting sZeroRecords Breaks sProcessing

cdwarrencdwarren Posts: 3Questions: 0Answers: 0
edited March 2010 in General
I'm adding sZeroRecords to my datatable, and when I do, my settings for sProcessing are being ignored. Any idea what I'm doing that would cause that?

This one works:
[code]

$(function() {
$('.datatable').dataTable({
"oLanguage": {
"sSearch": "Search",
"sProcessing": ''
},
"sPaginationType": "full_numbers",
"iDisplayLength": 20,
"bProcessing": true,
"bServerSide": true,
"bLengthChange": false,
"bStateSave": true,
"bFilter": true,
"bAutoWidth": false,
'aaSorting': [[0, 'desc']],
'sAjaxSource': '/jobs/datatable_response',

"aoColumns": [
null,{
'sType': 'html',
'bSortable':true,
'bSearchable':true

},null,null,null,null,null,null,{
'sType': 'html',
'bSortable':true,
'bSearchable':true
,'sClass':'state'
}
],
'fnRowCallback': function( nRow, aData, iDisplayIndex ) { $('td:eq(8)', nRow).addClass(aData[8].split('<')[0].replace(' ','_').toLowerCase()); $(nRow).attr('data-href',$('td:eq(1) a', nRow).attr('href')); return nRow; },
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json);
} );
}
}).fnSetFilteringDelay(500);
});

[/code]

This one breaks:
[code]

$(function() {
$('.datatable').dataTable({
"oLanguage": {
"sSearch": "Search",
"sProcessing": ''
},
"sPaginationType": "full_numbers",
"iDisplayLength": 20,
"bProcessing": true,
"bServerSide": true,
"bLengthChange": false,
"bStateSave": true,
"bFilter": true,
"bAutoWidth": false,
'aaSorting': [[0, 'desc']],
'sAjaxSource': '/jobs/datatable_response',
"oLanguage": {"sZeroRecords": "No Records Found"},
"aoColumns": [
null,{
'sType': 'html',
'bSortable':true,
'bSearchable':true

},null,null,null,null,null,null,{
'sType': 'html',
'bSortable':true,
'bSearchable':true
,'sClass':'state'
}
],
'fnRowCallback': function( nRow, aData, iDisplayIndex ) { $('td:eq(8)', nRow).addClass(aData[8].split('<')[0].replace(' ','_').toLowerCase()); $(nRow).attr('data-href',$('td:eq(1) a', nRow).attr('href')); return nRow; },
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json);
} );
}
}).fnSetFilteringDelay(500);
});

[/code]

The only difference is the removal of
[code]"oLanguage": {"sZeroRecords": "No Records Found"},[/code]

What's going on here?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You've got oLanguage defined twice. I'm not sure which one the Javascript engine will give priority to (some might be the first, others the second, and some might give an error, I would hope the latter...). It would be like { "a": 1, "a": 2 } :-). Put sZeroRecords in your first definition should work.

    Allan
  • cdwarrencdwarren Posts: 3Questions: 0Answers: 0
    Fantastic. That did it. Thanks Allan.
This discussion has been closed.