Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/01/2015, 16:32
Avatar de destor77
destor77
 
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 5 meses
Puntos: 43
html datatables

hola gente,
estoy teniendo un problemilla con el datatables jquery y codeigniter, tengo mi html que es este:
en mi php tengo esto:
Código PHP:
Ver original
  1. $tabla = $this->Players->playerAll();
  2.        $tabla->add_column('edit', '<a href="jugadores/editar/$1"><i class="glyphicon glyphicon-edit" title="Editar"></i></a>
  3.                                    <a href="#jugadores/borrar/$1" class="del" id="delete"><i class="glyphicon glyphicon-trash" title="Editar"></i></a>
  4.                                    <a id="view" href="jugadores/ver/$1"><i class="glyphicon glyphicon-eye-open" title="Ver info"></i></a>', 'u.id');
  5.  
  6.        $results = $tabla->generate('json');

El cual genera las filas (en la columna acciones agrega los links ) de la tabla html que tiene el siguiente código:
Código HTML:
Ver original
  1. <ol class="breadcrumb bc-3">
  2.     <li>
  3.     <a href="<?php echo base_url('admin');?>"><i class="entypo-home"></i>Inicio</a>
  4.     </li>
  5.     <li class="active">
  6.         <strong>Jugadores</strong>
  7.     </li>
  8. </ol>
  9.  
  10. <h2>Listado de Jugadores</h2>
  11. <br />
  12. <?php
  13. if(alert())
  14. {?>
  15. <div class="row">
  16.     <div class="col-sm-12">
  17.         <?php echo alert();?>    
  18.     </div>
  19. </div>
  20. <?php
  21. }
  22. ?>
  23. <table class="table table-bordered datatable" id="table-1">
  24.     <thead>
  25.         <tr>
  26.             <th>#Id</th>
  27.             <th>Username</th>
  28.             <th>Email</th>
  29.             <th>City</th>
  30.             <th>Activo</th>
  31.             <th>Balance</th>
  32.             <th>Acciones</th>
  33.         </tr>
  34.     </thead>
  35.     <tbody>
  36.        
  37.     </tbody>
  38.     <tfoot>
  39.         <tr>
  40.             <th>#Id</th>
  41.             <th>Username</th>
  42.             <th>Email</th>
  43.             <th>City</th>
  44.             <th>Activo</th>
  45.             <th>Balance</th>
  46.             <th>Acciones</th>
  47.         </tr>
  48.     </tfoot>

dentro de esa vista tengo este codigo js:
Código Javascript:
Ver original
  1. <script type="text/javascript">
  2.     $(function() {
  3.   console.log('hola');
  4.     $("#delete").click(function(e) {
  5.             console.log('entro');
  6.             return false;
  7.             e.preventDefault();
  8.             var url = $(".delete").attr('href');
  9.             $('#modal-4').modal('show', {backdrop: 'statuc'});
  10.  
  11.         });  
  12. });
  13.     jQuery(document).ready(function($)
  14.     {
  15.  
  16.         $("#table-1").dataTable({
  17.             "sPaginationType": "bootstrap",
  18.             "iDisplayLength": 5,
  19.             "aLengthMenu": [[5,10, 25, 50, -1], [5,10, 25, 50, "Todos"]],
  20.             "bStateSave": true,
  21.             "bProcessing": true,
  22.             "bServerSide": true,
  23.             "sAjaxSource": '<?php echo base_url(); ?>admin/jugadores/list_all',
  24.             "fnInitComplete": function () {
  25.             },
  26.             'fnServerData': function (sSource, aoData, fnCallback) {
  27.                 $.ajax
  28.                 ({
  29.                     'dataType': 'json',
  30.                     'type': 'POST',
  31.                     'url': sSource,
  32.                     'data': aoData,
  33.                     'success': fnCallback
  34.                 });
  35.             }
  36.         }
  37.         );
  38.        
  39.         $(".dataTables_wrapper select").select2({
  40.             minimumResultsForSearch: -1
  41.         });
  42.     });
  43. </script>

Lo que no me esta funcinando es que cuando hago click en el link para borrar deberia mostrar el modal (mas alla del return false que hay ahora) y no muestra nada. En la consola me muestra "hola" por ende el jquery lo toma bien, pero no me muestra "entro", y no entiendo porque me hace eso. Será porque a las filas las carga por json?
Espero que me puedan dar una mano....
Desde ya muchas gracias!