我想让mro_id列值是使用点燃数据表的特定操作的链接

时间:2016-02-24 16:02:16

标签: codeigniter datatables

如何将值作为点燃数据表中的链接?如何轻松实现?

控制器

 function index()
    {


        $tmpl = array ( 'table_open'  => '<table id="big_table" border="1" cellpadding="2" cellspacing="1" class="mytable">' );
        $this->table->set_template($tmpl); 

        $this->table->set_heading('First Name','Last Name','Email');

        $this->load->view('subscriber_view');
    }
function datatable()
    {

        $this->datatables
        ->select("mro_id,mro_name,mctg_name,mctg_id")
        ->from('jil_mroproducts')
        ->join('jil_mrocategory', 'jil_mroproducts.mro_category=jil_mrocategory.mctg_id', 'INNER')
        ->unset_column('mro_id');
         echo $this->datatables->generate();        

    }

1 个答案:

答案 0 :(得分:3)

试试这个

$this->datatables->edit_column('mro_id', '<a href="controller/method/$1">$2</a>', 'mro_id, mro_name');

$1指向mro_id

的链接

$2指向mro_name

的链接

阅读此$this->datatables->edit_column($column, $content, $match_replacement);