Programatically update a cell - value is lost

Programatically update a cell - value is lost

guidolsguidols Posts: 38Questions: 14Answers: 1

Hi,
starting from this example, I try to update a cell using, for instance:

$('#example').DataTable().cell({ row: 2, column: 2 }).data("test2").draw(false);

This will change the value in the table, but as soon as I reload the page the value is lost (i.e., is replaced with the "old" value"). I tried with draw(), draw(true) and draw(false) but nothing changes.

How can I update a cell?

Thank you!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,342Questions: 26Answers: 4,954
    Answer ✓

    If you are using the Editor then you will want to use the edit() API to edit the data and have the Editor save to the Database. The above only changes the data in the client table.

    Kevin

  • rf1234rf1234 Posts: 2,997Questions: 87Answers: 421

    The example you are quoting is with Editor and the values are saved to and loaded from a database. That doesn't seem to be your use case.

    Is your table dom sourced?
    Please see this: https://datatables.net/examples/data_sources/dom

  • guidolsguidols Posts: 38Questions: 14Answers: 1

    Thanks!

Sign In or Register to comment.