如何在使用表库时为codeigniter锚点添加自定义js函数


how to add custom js function for codeigniter anchor while using table library

这是我的代码:

foreach($patients as $patient) {
    $this->table->add_row(++$i,
                          $patient->opd_no,
                          $patient->sname.', '.$patient->fname.' '.$patient->mname, 
                          strtoupper($patient->gender),
                          date('M d, Y', strtotime($patient->birth_date)),
                          $patient->address_no.' '.$patient->address_st.' '.$patient->address_brgy.' '.$patient->address_local.' '.$patient->address_province,
                          anchor('consultation/queue/'.$patient->pk_id, 'Initial', ar
    ray('class' => 'queue'))
);

我想把它加在锚上。

编辑:好的,所以我添加了这个,希望这将是一个变通方法:

anchor('#'.$patient->pk_id, 'Initial', array('class' => 'queue', 'rel' => 'ic'))

并尝试通过jquery使用rel属性来调用一个函数。类似这样的东西:

$('a[rel=ic]').click(function() {});

但随后出现一个代码点火器错误页面,上面写着

您正在查看的页面由动态生成CodeIgniter。

我找到了解决方法。我没有使用CodeIgniter的锚点,而是使用本地html超链接标记<a>:

"<a href='#' class='queue' id='init_d'>Initial</a>"

使用jquery添加js要容易得多,而且以前的错误不再显示。

这里有另一个使用(模式)的选项

anchor('home/showpage','showpage',array('Click'=>'Inital()')