Change a specific cell's data via the row id

Change a specific cell's data via the row id

DevIcyDevIcy Posts: 4Questions: 2Answers: 0

I am updating certain rows via websockets. Each row has a id that is assigned when a row is added and is used for when an entire row is updated. I am now trying to change 1 cell of a row via the rowid for smaller updates as the data is changing multiple times per second.

This is what I tried (simplified code for question):

socket.onmessage = function(onmsg) {
var response = JSON.parse(onmsg.data);
var t = $('#example').DataTable();
var row = t.row('[id='+symbol+']').data();
t.cell({row:row, column: 2}).data(response.c).draw(false);
}

Any insight will be greatly appreciated!

Answers

  • DevIcyDevIcy Posts: 4Questions: 2Answers: 0

    I have found a way to get past the problem, however if there is a more efficient method, would love to hear! The way I solved it was by

    var id = t.row('[id='+symbol+']').index();
    t.cell({row:id, column: 2}).data(response.c).draw(false);

This discussion has been closed.