Reload jQuery DataTable with select

0

I have a DataTable with several elements, with a select I'm choosing all the values in column 0 depending on the value that the select has:

$("#idArticulos").change(function () {
    var opcion = $(this).find("option:selected");
    var valor = opcion.val();
    if (valor === "") {
        $('#tablaHistorial').DataTable().draw();

    }
    else {
        var data_table = $('#tablaHistorial').DataTable();
        var column_index = 0;
        data_table.columns(column_index).search(valor, true, false).draw();
    }
});

I'm trying when the select find a gap in the options I reloaded the DataTable to its original state, but I could not do it, draw() does not work for me or I'm not using it correctly, how can I solve this ?

    
asked by Baker1562 25.08.2018 в 21:28
source

0 answers