Warning (tech-note 4) fired for empty cells (not null nor undefined, simply = '')

Warning (tech-note 4) fired for empty cells (not null nor undefined, simply = '')

cFreedcFreed Posts: 21Questions: 4Answers: 0

I'm using DataTables-1.10.16.

All works fine with Firefox and Chrome.

But with IE11 I get the DataTables warning: table id={id} - Requested unknown parameter '{parameter}' for row {row-index}, column{column-index}.
It clearly appears for each cell having content = ''.
The warning fires not only when initially displaying the table content, but also each time a cell content is changed to ''.

Since it happens with IE11 only, my first guess was about a comma after the last member of an object or array. But:
* IE uses to fire a console alert when it happens, and it's not the case here
* nevertheless I carefully checked for that and didn't found anything
* and actually, regarding the tech-note suggestion about if using dt-init columns, my dt-init is dynamically populated by push() so no additional comma can appear

Then I examined the very content of the involved cells. But:
* their content comes from a source that I can console.log() and they well appear as a simple empty strings, not undefined nor null.
* anyway, in case there is some unidentified bug in my code when the data is processed between source and DataTable.row.add(), I just tried to add defaultContent: '' to each of the dt-init.columns members, and it keeps firing the warning.

So now I feel totally stuck: what else should I examine to explain what is happening?
TIA.

This question has an accepted answers - jump to answer

Answers

  • cFreedcFreed Posts: 21Questions: 4Answers: 0

    Forgotten in the previous post!

    Maybe interesting: after Ok on warning, each involved (empty) cell displays "null" (so we might infer that DataTables found the content as null?)

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin
    Answer ✓

    It looks like it yes. Can you link to a page showing the issue and I can take a look? Or use the debugger after the error has occurred, that might give me something to go on.

    Allan

  • cFreedcFreed Posts: 21Questions: 4Answers: 0

    @allan Thanks a lot for your answer.

    I didn't know the existence of the DataTables debugger.
    Great tool, that allowed me to rapidly identify where the issue comes from.

    In the render process, certain cells are configured to use a function which drops some HTML tags from the cell content.
    For some reason, when the original content is an empty string, with IE this function returns undefined rather than renewing an empty string.

    FYI, a precision:
    My question notably reported that adding defaultContent: '' didn't avoid the issue: this was particularly puzzling.
    I now realized that in my tests, while I was juggling with the multiple combinations of 3 browsers and 2 sites (the local one and its hosted copy), I simply omitted to transmit the change to the hosted version! Sigh...

    So obviously there is no longer any question regarding DataTable about this issue.

    For the sake of accuracy, just a remark:
    I repeat and confirm that, when the issue appeared and after clicking Ok on the warning dialog box, the involved cell displays "null".
    But now I can assert that the data really "received" by DataTables was undefined, not null.
    I guess it comes from DataTables simply using a unique message for both occurrences?

    In any case, thanks again.

    Fred

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin

    Hi Fred,

    Good to hear you've got it working as you need now.

    But now I can assert that the data really "received" by DataTables was undefined, not null.

    You would have to use columns.render as a function and an if statement which checks to see which of the two was present (or not in the cause of undefined!). The DataTables warning will make no distinction between the two.

    Allan

  • cFreedcFreed Posts: 21Questions: 4Answers: 0

    Hi allan,

    You would have to use columns.render as a function and an if statement which checks to see which of the two was present (or not in the cause of undefined!)

    So it's what I guessed. Not a need for me, though: I only pointed it to ensure that it was "normal".

    But thanks again for this last advice.

    Fred

This discussion has been closed.