Update value using API updates the wrong row
Update value using API updates the wrong row
![Clayton](https://secure.gravatar.com/avatar/c54d41cda3f248863c553e618b5100a3/?default=https%3A%2F%2Fvanillicon.com%2Fc54d41cda3f248863c553e618b5100a3_200.png&rating=g&size=120)
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!