【发布时间】:2014-10-12 15:43:27
【问题描述】:
我正在使用“Vincent Bambico and Yusuf Ozdemir”编写的数据表库 https://github.com/IgnitedDatatables/Ignited-Datatables
我查看了此处提供的支持信息http://codeigniter.com/forums/viewthread/160896/
我在使用编辑列功能时遇到问题。
function paging()
{
$this->load->helper('form');
$this->load->library('Datatables');
$this->datatables->select('id, name, visit_date, date_created, postcode, order_total, status')
->from('day_orders')
->edit_column('status','$1', 'callback_cap(status)')
->edit_column('date_created','$1', 'callback_date(date_created)');
echo $this->datatables->generate();
}
public function cap($i)
{
return ucfirst($i);
}
public function date($i)
{
return date('d-m-Y', $i);
}
我得到的不是输出到 json 字符串的数据,而是作为第三个参数输入的文本,例如“callback_date(date_created)”。不太确定我做错了什么?有什么想法吗?
编辑: 问题似乎是图书馆找不到我的任何回调函数。上面的代码示例都包装在一个类中。我已经尝试将回调函数放在几个不同的地方,包括在 lib 文件中,但我仍然没有任何运气。
当我们开始通过“function_exists”检查函数是否存在时,找不到函数。我做了一些研究,我认为问题是由于我使用的类结构造成的,但我不确定如何解决这个问题。
【问题讨论】:
标签: php jquery codeigniter datatables