Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81937

Reload all data send id and json

$
0
0

Hello,
I try to refresh the table to each click in which a parameter is sent, I honestly do not know how to do that process.

The following code does what I need but I'm not sure it's the right one.

      $('.rsel').click(function(e){
        $('#wlista').css('display','block');
        idexp = $(this).attr('id');
        $('#wlista').find('h2').text($($('figcaption span')[idexp]).text());

        if(table != null) {
          table.destroy();
        }

        table = $('#datatable').DataTable({
            "autoWidth": false,
            "order": [[ 0, "desc" ]],
            "processing": true,
            "ajax": {
              "url":"<?php echo base_url() ?>documentos/getDocExpAjax",
              "type": "POST",
              "data": {
                id_expediente: idexp
              },
            },
            "columns": [
              { "data": "id_documento" },
              { "data": "identificador" },
              { "data": "nombre_documento" },
              { "data": "productor" },
              { "data": "estado"},
              { "data": "accion"}
            ],
            "columnDefs": [
              {
                "targets" : [5],
                "visible" : ("<?php echo $this->session->userdata('codigo') ?>" == 'AD') ? true : false,
                "searchable" : ("<?php echo $this->session->userdata('codigo') ?>" == 'AD') ? true : false,
              }
            ],
            "language":
              {
                "url": "<?php echo base_url('vendors/datatables.net/i18n/Spanish.json') ?>"
              },
        });
      });


Viewing all articles
Browse latest Browse all 81937

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>