Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/12/2019, 13:16
Avatar de emilio_viguri
emilio_viguri
 
Fecha de Ingreso: junio-2011
Ubicación: Mexico
Mensajes: 116
Antigüedad: 12 años, 10 meses
Puntos: 3
Pregunta DataTable dos tablas diferentes

Hola que tal estoy intentando implementar mas de 2 DataTables en la misma hoja, pero no logro hacerlo, solo pude poner una datatable, pero no se como debieran ir las otras dos me podrían ayudar con ello ?! Voy a resumir para no mostrar tantas lineas ...

Código HTML:
Ver original
  1. <table class="table table-bordered" id="tbListado">
  2.               <thead>
  3.                 <tr>
  4.                   <th>Factura</th>
  5.                   <th>Fecha</th>
  6.                 </tr>
  7.               </thead>
  8.               <tbody>
  9.               </tbody>
  10.               <tfoot>
  11.                 <tr>
  12.                   <th>Factura</th>
  13.                   <th>Fecha</th>
  14.                 </tr>
  15.               </tfoot>
  16.             </table>
  17.  
  18. //Funcion de Inicio();
  19. inicio();

Función inicio de Javascript solamente carga la funcion de clientes() para llenar la tabla tbListado con funcion clientes()

Para mandar los datos de la DataTable hago esto asta aquí no hay problema se muestra una tabla...

Código Javascript:
Ver original
  1. function clientes(){
  2.   tabla = $('#tbListado').dataTable({
  3.     "aProcessing": true, "aServerSide": true, dom: 'Bfrtip',
  4.     "ajax":{
  5.       url: '../ajax/' +ajaxFile+ '.php?op=listar
  6.      type: "get",
  7.      dataType: "json",
  8.      error:function(e){ //en caso de errores
  9.     console.log(e.responseText);
  10.      }
  11.    },        
  12.    "bBestroy": true,
  13.    "iDisplayLength": 10, "order": [[1, "desc"]] }).DataTable();
  14. }

Para implementar otra tabla según yo implementaría otros <table> con id diferentes

<table class="table table-bordered" id="tbListadoDos">
<table class="table table-bordered" id="tbListadoTres">

Y después podría mis funciones
function sucursales(){ tablaDos = $('#tbListadoDos').dataTable({ etc
function usuarios(){ tablaTres = $('#tbListadoTres').dataTable({ etc

Y así debiera mostrarme 3 DataTable con los resultados diferentes según sea la funcion
__________________
Ing. Emilio Viguri de NEXCEN Visitamos en lo que podamos ayudarte.