I have a function that removes the row from a table, after removing it I need to be called the function
getTotal();
.
But any way 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 currently doing this, 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();
}