DataTables and AJAX

DataTables and AJAX

cduicucduicu Posts: 2Questions: 0Answers: 0
edited February 2013 in DataTables 1.9
Hi, I am a noob with datatables so please forgive me if I ask a very trivial question.
I have a problem with AJAX loaded table: when I configure sDom property and make it load the data via AJAX there is an error reported: "Uncaught TypeError: Cannot read property 'length' of undefined ". If I remove the sDom it works fine. Also if I keep the sDom and remove the AJAX loading it works fine. Any help is greatly apreciated.
Here is the code:
HTML:
[code]

Col1Col2Col3



[/code]
JS:
[code]
var $table = $('#test');
$table.dataTable( {
"sDom": 'tif',
"bDeferRender": true, "bProcessing": true, "sAjaxSource": "/test/0"
} );
[/code]
Here is a jsFiddle to reproduce the error: http://jsfiddle.net/cduicu/Mbj9b/

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    > "bProcessing": true

    and

    > "sDom": 'tif'

    You've enabled processing, but not included the processing element. So add `r` to your sDom and that should be it.

    Allan
  • cduicucduicu Posts: 2Questions: 0Answers: 0
    Thank you Allan! That fixed it!
This discussion has been closed.