How to programmatically update a cell's value?

How to programmatically update a cell's value?

Karl53Karl53 Posts: 72Questions: 29Answers: 0

In editor.on('preSubmit', function (e, o) { I want to update the value of a readonly cell, totalPrice.

My code basically looks like this:

 if (o.data.quantityOrdered > 0 && o.data.unitPrice > 0) {
 
      o.data.totalPrice = o.data.quantityOrdered * o.data.unitPrice;
 
  }
 
  table.row(x).data(o.data).draw();

Above does not refresh the value shown in the cell. How should I be doing this?

Thank you.

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    The above will submit totalPrice to the server as calculated. Does the server then process that data and return it for the edited row?

    Allan

  • Karl53Karl53 Posts: 72Questions: 29Answers: 0

    Hi Allan, sorry, I had meant to indicate that I'm not using a server. I'm using the JavaScript / CSS only package.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Okay - but the point still stands. The data must be submitted somewhere processed and stored, then the data returned as per the client / server communication.

    Allan

This discussion has been closed.