Update value using API updates the wrong row
Update value using API updates the wrong row
I have a column that need to be updated every minute. I read new values and iterate over the table data to update some rows. But the row returned by "table.rows().data().each()" is different from row accesssed by "table.cell(x,y)". In the following example, there is a console output showing the different values from the same row:
http://jsbin.com/poyabeqadefu/3/
I tried to update the table using the data returned by "table.rows().nodes().toJQuery()". I can update the value from the correct row, but the column cannot be sorted.
This question has an accepted answers - jump to answer
Answers
I think there is a mix of indexes here:
i
is the index in therows().data()
array - which in this case is the index in the display order arraycell(i, 0)
wherei
should be the row index - but it isn't, its the display indexIf I understand correctly I think you want to use
rows( { order: 'index' } ).data()
to get the data array in index order. But its late on a Friday so I might not be understanding 100% ;-)Allan
Worked, thank you!