dataTable displays only one row from ajax call

dataTable displays only one row from ajax call

SigalSigal Posts: 8Questions: 1Answers: 0
edited September 2013 in DataTables 1.9
Hello,

I am creating a dataTable with AJAX.

Unfortunatly the site is on my local machine and I can't upload it to a live server yet.

AJAX returns 2 rows from the database yet the table displays only one row.

I tried to use the dataTable debugger link, but I get a message: dataTables is not available on this page.

I am calling the dataTable like this:
[code]$('#logsTbl').dataTable({
"bProcessing": true,
"bDestroy": true,
"sAjaxSource": "/modules/logs/ajax/list_logs.ajax.php?target_id=" + target_id,
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": false },
{ "bSortable": false }
],
"bJQueryUI": true,
"bSortClasses": false,
"sPaginationType": "full_numbers"
});[/code]

The json string I get back from the AJAX call looks like this:
[code]{"found":1,"aaData":[["2013-09-30 11:01:41","adrianB","EVENT_TYPE_USER","Question created: asfasfdasfd","Create New Question","","2013-09-30 11:01:34","adrianB","EVENT_TYPE_USER","Question created: asdfasfd","Create New Question",""]]}[/code]

The table displays only the first row from the json string.

Can someone please help?

Replies

  • SigalSigal Posts: 8Questions: 1Answers: 0
    I managed to upload the site online, but the debugger still gives me the same error:
    DataTables is not available on this page
  • SigalSigal Posts: 8Questions: 1Answers: 0
    Ok, I saw that the json returned was wrong, it was not breaking the rows with the ] tag.

    Something was wrong with my ajax file, and something maybe was stuck in the cached.

    Changed my ajax file, restarted my computer and now everything works.
This discussion has been closed.