Update row cell

Update row cell

lauromnetolauromneto Posts: 129Questions: 0Answers: 0

Good afternoon.
I have a function where, on successful completion, I remove the specific line, as per the code below:

table.row($('#object_'+id).parents('tr')).remove().draw();

However, I have another one that does an update and, on success, I need to update the specific line in a certain cell.
How do I do this?

Replies

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,770

    You can use cell().data() to update a particular cell. Or you can use row().data() and update the particular column with the row of data.

    Kevin

  • lauromnetolauromneto Posts: 129Questions: 0Answers: 0

    I can't find a valid example and I'm not getting it right.
    I'm trying it this way, but I don't know where it's wrong:

    var id = table.row($('#object_'+id).parents('tr')).index();
    table.cell({row:id, column: 1}).data(data.nomeE).draw();

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,770

    Its hard to say specifically what you need to do without a test case showing what you have and what cell you want to update. For example we don't know what the result of var id = table.row($('#object_'+id).parents('tr')).index();.is and if its appropriate for the row-selector.

    Instead of table.cell({row:id, column: 1}) try table.cell({id, 1}). You can either use cell-selector or pass in the row and column using row-selector, column-selector. I don't think {row:id, column: 1} is a valid option.

    See this simple example:
    http://live.datatables.net/dayucisi/1/edit

    Kevin

  • lauromnetolauromneto Posts: 129Questions: 0Answers: 0

    I achieved !

    var idT = table.row($('#object_'+id).parents('tr')).index();
    table.cell({row:idT, column:2}).data(nomeE).draw(false);

    I was using the variable id, which I was already using above to send in the data, so I changed it to idT

    Thanks again for your willingness.... God bless you all !!!!

Sign In or Register to comment.