"No data available in table" server side

"No data available in table" server side

vitalikvitalik Posts: 1Questions: 0Answers: 0
edited February 2020 in Free community support

Hi there, I have seen that it question has answer but it doesn't help me :(.

js:
$('#example').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "http://mysite.com/admin/clients/ajax-list"
} );

response from server:
{"data":{"draw":1,"recordsTotal":57,"recordsFiltered":57,"data":[{"name":"Airi","position":"Satou","office":"Accountant","extn":"Tokyo","start_date":"28th Nov 08","salary":"$162,700"},{"name":"Airi","position":"Satou","office":"Accountant","extn":"Tokyo","start_date":"28th Nov 08","salary":"$162,700"}]}}

I don't get any errors.

Replies

  • allanallan Posts: 63,205Questions: 1Answers: 10,415 Site admin

    Can you change the response from the server to be:

    {"draw":1,"recordsTotal":57,"recordsFiltered":57,"data":[{"name":"Airi","position":"Satou","office":"Accountant","extn":"Tokyo","start_date":"28th Nov 08","salary":"$162,700"},{"name":"Airi","position":"Satou","office":"Accountant","extn":"Tokyo","start_date":"28th Nov 08","salary":"$162,700"}]}
    

    i.e. drop that outer data - that isn't part of DataTables expects.

    Allan

This discussion has been closed.