"sData is null" error

"sData is null" error

samy_rsamy_r Posts: 13Questions: 0Answers: 0
edited May 2011 in DataTables 1.8
Hi,
Following the allan advice of using 1.8 version to solve my re-ordering problems, I just tested the 1.8b1 on one of my pages.

With the 1.7.6 version, no problem, the datatable is displaying my datas (retrieved using sAjaxSource and a custom fnServerData function).

But, with 1.8b1, the "sData is null" error is fired at line 720 :
"if ( typeof sData == 'number' || sData.length === 0 )"

(the init code for my DT is very standard, and works with 1.7.6)

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Can you should me the JSON data that you are using in the table? In DataTable 1.7.x it will always 'cast' the variable as a string, which is a bit nasty, since you then loose your original data type. I'm reasonably certain that this will be the problem here, but I'd need to know what the data is that you are using in order to be able to know why it is happening.

    Thanks,
    Allan
  • samy_rsamy_r Posts: 13Questions: 0Answers: 0
    edited May 2011
    It looks like this : http://pastie.org/private/hl26ylv1kyn2ez91ubycq (here is the console.info(json) result from my ajax call).

    To make a temp patch, I correct the function adding this :
    [code]
    if (sData == null) {
    sData = '';
    }
    [/code]
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Nice one - thanks for that. Looks like true and false are also giving that function grief. I'll have a fix in the nightly builds soon :-)

    Allan
  • samy_rsamy_r Posts: 13Questions: 0Answers: 0
    Thanks !
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    I've just committed in a fix for this. You can get it in the nightly here: http://datatables.net/download/ and it will be in the next beta, which I hope to release fairly soon :-). Give me a shout if you have any problems with that.

    Allan
  • samy_rsamy_r Posts: 13Questions: 0Answers: 0
    I just tested it : no problems (for the functions I use, I mean)
This discussion has been closed.