1
I have a function that removes the row from a table, after removal I need it to be called to function
getTotal();
.
But in any way that I put it does not work, because of the effect of the line, I need to wait for the effect to pass, and call the function.
I’m actually doing it this way, but it’s not working:
function ExcluirProdutoPedido(linha) {
if ($thatRow == null) {
alert('Selecione uma linha para fazer a exclusão.');
}
else {
$thatRow.closest("tr").fadeOut(500, function () {
$thatRow.remove();
})
getTotal();
}
}
How to proceed? EDIT
Function getTotal();
function getTotal() {
debugger;
let result = 0;
let columns = $("#tablepesquisaprodutos tr td:nth-child(" + 8 + ")");
columns.each(i => {
result += parseFloat($(columns[i]).html().replace(/\./g, '').replace(',', '.'));
});
$("#ValorTotalPedido").val(result.toFixed(6).replace(".", ","));
result = 0;
columns = $("#tablepesquisaprodutos tr td:nth-child(" + 11 + ")");
columns.each(i => {
result += parseFloat($(columns[i]).html().replace(/\./g, '').replace(',', '.'));
});
$("#TICMS").val(result.toFixed(2).replace(".", ","));
result = 0;
columns = $("#tablepesquisaprodutos tr td:nth-child(" + 13 + ")");
columns.each(i => {
result += parseFloat($(columns[i]).html().replace(/\./g, '').replace(',', '.'));
});
$("#TISS").val(result.toFixed(2).replace(".", ","));
result = 0;
columns = $("#tablepesquisaprodutos tr td:nth-child(" + 15 + ")");
columns.each(i => {
result += parseFloat($(columns[i]).html().replace(/\./g, '').replace(',', '.'));
});
$("#TIPI").val(result.toFixed(2).replace(".", ","));
var IPI = document.getElementById("TIPI").value;
var TotalPedido = document.getElementById("ValorTotalPedido").value;
var vIPI = 0;
var vTotalpedido = 0;
var vTotalProduto = 0;
vIPI = Number(IPI.replace(/[R\$ \.]/g, '').replace(',', '.'));
TotalPedido = Number(TotalPedido.replace(/[R\$ \.]/g, '').replace(',', '.'));
vTotalProduto = TotalPedido - vIPI;
document.getElementById("ValorProdutos").value = (parseFloat(vTotalProduto).toFixed(6).replace(".", ","));
DescontoGlobal1();
}
What getTotal() does?
– Lucas de Carvalho
It adds up the table @Lucascarvalho. So I need to finish removing the line, otherwise it adds up wrong.
– Mariana
@Sam has done it, and not right.
– Mariana
@sam I have done it already, he enters the function, he is understanding as if the line had not been deleted. It keeps adding her even after the exclusion.
– Mariana
but is deleting correctly? who passes the value to "$thatRow "?
– Ricardo Pontual