javascript - Pass id param from Datatable to controller -
i want pass id param of clicked row button of datatable controller (by url or ajax, or something). i'm using url call method on controller , works, don't know how can passed id (in code **************) of column. datatable in js is:
var t_festivos = <?php echo json_encode($t_festivos); ?>; if ( t_festivos !== null){ var table = $('#t_festivos').datatable( { language: { "url": "<?=trad($this,'idioma_datatables');?>" }, data: t_festivos, paging: true, ordering: true, pagelength: 10, columndefs: [ { "targets": 0, "visible": false }, { "targets": -1, "data": null, "defaultcontent": "<center><a class='btn btn-danger' href='<?=base_url()?>index.php/mantenimiento/borrar_festivo/(**************)'><i class='fa fa-trash'></i></a></center>" } ], columns: [ { title: "" }, { title: "<?=trad($this,'fecha');?>" }, { title: "" }, ] } ); }
i solve problem writting html code in controller:
for ($i=0; $i< count( $festivos->filas); $i++){ $t_festivos[$i][0] = $festivos->filas[$i]->fecha; $t_festivos[$i][1] = "<center><a class='btn btn-danger' href='" . base_url() . "index.php/mantenimiento/borrar_festivo/" . $festivos->filas[$i]->idfestivo . "' ><i class='fa fa-trash'></i></a></center>"; }
Comments
Post a Comment