Server-Side Processing - Empty return aoData

Server-Side Processing - Empty return aoData

izzy6150izzy6150 Posts: 49Questions: 0Answers: 0
edited November 2009 in General
Hi,

Is there anyway to get the server-side processing to do the empty row when no data is passed back to the dataTable?
I have just run into this where I have done a search for something that doesn't exists and the table doesn't change and the processing div does not disapear after the return of the json (I am guessing because aoData is empty
[code]
{ // other details returned ...
'aoData': [] }
[/code]

Regards,
Izzy

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Izzy,

    That looks perfectly valid to me actually - and this should work! If you have a look at this example - http://datatables.net/examples/data_sources/server_side.html - and type 'rubbish' into the search box, you'll see that this should work, and aaData (not aoData!) is an empty array.

    Perhaps if you could post your full JSON string (or run it through jsonlint.com) that would be helpful, as it sounds like the JSON might not be valid.

    Regards,
    Allan
  • bilbodigibilbodigi Posts: 18Questions: 0Answers: 0
    Hi,
    I run in to the same problem.
    The JSON look´s like this
    [code]
    {"sEcho": 2, "iTotalRecords": 9, "iTotalDisplayRecords": 0, "aaData": [] }
    [/code]
    I also get an error in firebug

    "oSettings.aoData[iDataIndex] is undefined"

    Can´t find whats wrong, so please give me some hints where i can look.

    Regards,
    Ingvar
  • bilbodigibilbodigi Posts: 18Questions: 0Answers: 0
    Found it
    [code]
    $('#adminData tbody td').each( function () {
    var oaSettings = oaTable.fnSettings();
    if(oaSettings._iRecordsDisplay != 0){ //Solution : if empty data don't set click function
    var iPos = oaTable.fnGetPosition( this );
    [/code]
This discussion has been closed.