Empty Ajax Response wont render in DataTables 1.10

Empty Ajax Response wont render in DataTables 1.10

btreebtree Posts: 99Questions: 14Answers: 11

Hello,

first good work on Version 1.10. Yesterday I updated and "everything" work smoothly. I only got a small problem, when sending an empty array - processing message wont stop (only when i click on a table header for sorting) and i get the console error "Cannot read property 'length' of undefined" on Line .min.js:43.

In 1.9 it is working, without console error

I tried an empty array and one with total record 0, both not working.
http://debug.datatables.net/iquhih

Cheers from Austria
Hannes

This question has an accepted answers - jump to answer

Answers

  • btreebtree Posts: 99Questions: 14Answers: 11
    edited May 2014

    Hello,

    fixed it. Added sEcho and iTotalDisplayRecords.

    My working PHP Code for empty tables:

    $output = array(
    "sEcho" => 1,
    "iTotalRecords" => 0,
    "iTotalDisplayRecords" =>0,
    "aaData" => array()
    );
    $array[]="";
    echo json_encode($output);
    

    edit: sorry dont know how to set the question answered :(

  • RpiechuraRpiechura Posts: 98Questions: 3Answers: 14
    edited May 2014 Answer ✓

    Doesn't appear to be a way to do it by yourself, however when someone else responds to your thread I believe it automatically marks it as answered but not accepted. You should be able to accept that persons answer as correct if you're pleased with their response. It's odd that there doesn't seem to be a way to do that to your own posts though.

    Glad to hear you figured it out though =)

This discussion has been closed.