json - jQuery Datatables: display empty table message -
i use jquery datatables display data. works perfect in case server provides no data, plugin gives following warning: "datatables warning (table id = 'notes'): datatables warning: json data server not parsed. caused json formatting error."
why not display empty table message. have response server display message "there no entrys ..."
thank you
i found solution problem
the server-response have empty object looks this:
{"data":[]}
u have set property-name (is case "data") in datatables init-code like:
var otable_notes = $("#notes").datatable({ ... "sajaxdataprop": "data", ... });
then, if "data" empty shows "semptytable" - message ...
you should return json server appropriate format, example:
{ "secho": 1, "itotalrecords": 0, "itotaldisplayrecords": 0, "aadata":[ ] }
Comments
Post a Comment