fnUpdate bug in 1.9.4?
fnUpdate bug in 1.9.4?
jeffro
Posts: 1Questions: 0Answers: 0
Hello, I've noticed that fnUpdate( [row], pos, col) no longer works as expected when col == 1 (or any other number). The documentation says that col is ignored if the data passed in is an array, but what actually happens is that it puts the passed in array into the column. So when I do this:
fnUpdate([1, 2, 3, 4, 5], 1, 1)
I get something like
[1, [1, 2, 3, 4, 5], 3, 4, 5]
instead of
[1, 2, 3, 4, 5]
The code comments say
oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, 0 ); // Row
But the code itself does the following check
if ( $.isArray(mData) && iColumn === undefined )
So it appears that the docs and comments are incorrect and that col must be undefined for the array case to work.
fnUpdate([1, 2, 3, 4, 5], 1, 1)
I get something like
[1, [1, 2, 3, 4, 5], 3, 4, 5]
instead of
[1, 2, 3, 4, 5]
The code comments say
oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, 0 ); // Row
But the code itself does the following check
if ( $.isArray(mData) && iColumn === undefined )
So it appears that the docs and comments are incorrect and that col must be undefined for the array case to work.
This discussion has been closed.
Replies
I'm sorry to say that the documentation is actually wrong here - I'm working on a fix. Because of the newer abilities of 1.9.x a single array can be the value of a single cell, so automatically assuming an array is for the whole row is incorrect. You need to pass in 'null' for the column if you are to target the whole row.
Allan
{int}: The column to update (set to null or undefined to update the whole row)
In actuality, the code explicitly checks for undefined - specifying a null causes an error and the fnUpdate fails (I am passing an object as my first parameter - on looking at the code it appears that the same would apply if I passed an array).
Simply modifying the documentation to specify undefined only (not null) would fix this problem.
Thanks!
This will all be must simpler with the 1.10 API (when it is done!).
Allan