Update table (bootstrap-table) automatically when passing parameters of two input?

0

How can I make my table update automatically taking the value of two input in JS , I use JSON , and can pass the parameters to the query the problem is that my table is not updated.

This is some code I use, researching I found that Bootstrap Table uses the property "refresh" {query: {foo: 'bar'}} .

How would you adapt it?

function actualizarTabla(datoFechaIni, datoFechaFin) {
  obtenerTablaAjax('venta', '<?= base_url(); ?>index.php/modulos/supervisor/supinicio/datos_ventas', {
    fechaIni: datoFechaIni,
    fechaFin: datoFechaFin
  }, '<?= base_url("assets/img/elems/loader.gif"); ?>');
}

function cargaInicial() {

  $("#e-fechaInicio").change(function() {
    actualizarTabla($("#e-fechaInicio").val(), $("#e-fechaFin").val());
  });
  $("#e-fechaFin").change(function() {
    actualizarTabla($("#e-fechaInicio").val(), $("#e-fechaFin").val());
  });

}
    
asked by Soldier 14.07.2017 в 20:09
source

1 answer

0

BootstrapTable is quite simple to use, it would be enough

$('#venta').bootstrapTable("refresh", {
    url: "<?= base_url(); ?>index.php/modulos/supervisor/supinicio/datos_ventas",
    query: {
        fechaIni: datoFechaIni,
        fechaFin: datoFechaFin
    }
});

As you can see, bootstrapTable takes a string as the first argument, which indicates the command. The second argument is an object with the necessary data such as the request URL and the query it requires.

    
answered by 14.07.2017 / 20:23
source