Reload my AJAX table

0

I am trying to make a table update automatically, by calling AJAX , for example when I change the range of dates these are sent to a model that executes a function and takes the parameters and performs the query.

The problem here is that I do not update my my JSON , if you bring the data but do not paint the table, I use bootstrap-tables .

This is how I have the code so far,

function actualizarTabla(datoFechaIni, datoFechaFin) {
  obtenerTablaAjax('ejemplo', '<?= base_url(); ?>index.php/modulos/diegov/ejemplo/datos', {
    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());
  });

}

and my table is like this

$('#ejemplo').bootstrapTable({
    url: '<?= base_url(); ?>index.php/modulos/diegov/ejemplo/datos',
    columns:[
      {field: 'reStatus', cellStyle: cellStyle,filter:{type:"input"}},
      {field: 'ocTipoCompra',filter:{type:"input"}},
      {field: 'faClave', footerFormatter: totalItems,filter:{type:"input"}},
      {field: 'tiPesoNeto', footerFormatter: totalToneladas,filter:{type:"input"}},
      {field: 'inpo', footerFormatter: totalImporte,filter:{type:"input"}}
    ],

    pagination: true,
    showFooter: true,
    search: true,
    showExport:true,
    filter: true,
    method: 'post',
    showRefresh:true,
    showPaginationSwitch: true
  });

Someone who can help me, thanks

    
asked by Soldier 20.07.2017 в 21:07
source

1 answer

1

Try refreshing the table

$('#table').bootstrapTable('refresh');
    
answered by 13.12.2017 в 19:40