change the value of the one column in one row
change the value of the one column in one row

Hi, I need to update the value of a cell in a row.
I go through the table in the following way:
var existe = false;
detalles.rows().every(function (value, index) {
var data = this.data();
if(data.prod_code == $('#prod_code').val()){
existe = true;
}
});
instead of
exists = true
I want to change the value of the prod_quantity column.
How can I do?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @guillermovil ,
You can set the data for that row with
row().data()
(orcell().data()
for individual cells). Note you have to do thedraw()
afterwards, but you'll see that in the examples.Cheers,
Colin
Colin, could you please give me an example?
My table is defined as follows:
I tried the following but the value is not modified
Hi @guillermovil ,
You're updating the local copy, but not writing it back.
Try changing your line 9 from
to
If no joy, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
muchas gracias Colin!!
thank you very much Colin!!