Every time I make a change in the select, it calls this function, it picks the id of the selected tax and searches for the (daughters) tax rules, I need to update the table every time it changes. DataTables warning: table id = imposed rules - Can not reinitialise DataTable. For more information about this error, please see link
function pesquisaRegrasImpostos(imposto){
if (imposto != "") {
$.ajax({
url: '/pesquisa/regraimposto/${imposto}',
success: function(data){
$("#regrasimpostos").DataTable({
"processing": true,
"serverSide": true,
"ajax": '/pesquisa/regraimposto/${imposto}',
"columns": [
{"data" : "impostoNome"},
{"data" : "modelo"},
{"data" : "pessoa"},
{"data" : "contribuinte"},
{"data" : "estado"},
{"data" : "cfop"},
{
"data" : null,
defaultContent: '<a href="#" title="Editar" data-id="impostoID" onclick="editarRegra('variavel')"><i class="edit icon"></i></a>'
}
]
})
},
error: function(error){
alert(JSON.stringify(error));
}
});
}
}