Update value using API updates the wrong row

Update value using API updates the wrong row

ClaytonClayton Posts: 2Questions: 1Answers: 0

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

  • allanallan Posts: 62,858Questions: 1Answers: 10,344 Site admin
    Answer ✓

    I think there is a mix of indexes here:

    • i is the index in the rows().data() array - which in this case is the index in the display order array
    • cell(i, 0) where i should be the row index - but it isn't, its the display index

    If 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

  • ClaytonClayton Posts: 2Questions: 1Answers: 0

    Worked, thank you!

This discussion has been closed.