how to disable warning from datatables sErrMode seemd doesn't work

how to disable warning from datatables sErrMode seemd doesn't work

robbin1006robbin1006 Posts: 2Questions: 0Answers: 0
edited June 2011 in General
I wonder how to disable warning issued by datatables。 I already know $.fn.dataTableExt.sErrMode is key, but I dont't know how to use it
. the code below:

$(document).ready(function() {
$.fn.dataTableExt.sErrMode = 'throw';
var oTable = $('#example').dataTable( {
"bProcessing": false,
"sAjaxSource": "sources/arrays.txt"
} );
} );
}

when I alter the arrays.txt content, arrays.txt is not valid, but the code does't work,cant you give me an example how to use $.fn.dataTableExt.sErrMode attribute to disable warning issued by datatables。

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    What you've done is correct - however, if it is a JSON error you are getting then DataTables will always give an alert: https://github.com/DataTables/DataTables/blob/master/media/js/jquery.dataTables.js#L1343 . Previously there was no option for it to get access to the sErrMode property - but it is now, so I'll look at changing that.

    So there are a number of options:

    1. Modify that line in DataTables
    2. Set your own fnServerData function which doesn't give an alert
    3. Don't send invalid JSON :-)

    Allan
  • robbin1006robbin1006 Posts: 2Questions: 0Answers: 0
    thanks a lot , I will have a try
This discussion has been closed.