将id参数从Datatable传递到控制器


Pass id param from Datatable to controller

我想通过我的数据表的点击行按钮的id参数到我的控制器(通过url或ajax,或其他东西)。我使用url调用我的控制器上的一个方法,它的工作原理,但我不知道如何可以传递id(在代码**************)的列。我的数据表在js中是:

    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: "" },
            ]
        } );
    }

我解决了在控制器中编写html代码的问题:

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>";
        }