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

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -