本文整理汇总了PHP中Datatables::simple方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatables::simple方法的具体用法?PHP Datatables::simple怎么用?PHP Datatables::simple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datatables
的用法示例。
在下文中一共展示了Datatables::simple方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sessions_ajax
function sessions_ajax()
{
if (!$this->input->is_ajax_request()) {
exit('No direct script access allowed');
} else {
$table = '' . DBPREFIX . 'session';
$primaryKey = 'id';
$columns = array(array('db' => 'id', 'dt' => 'id'), array('db' => 'ip_address', 'dt' => 'ip_address'), array('db' => 'timestamp', 'dt' => 'timestamp'), array('db' => 'id', 'dt' => 'action', 'formatter' => function ($id) {
return '<a href="' . base_url('' . $this->uri->segment(1) . '/sessions/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
}));
$sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
$this->output->set_content_type('application/json')->set_output(json_encode(Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns), JSON_PRETTY_PRINT));
}
}
示例2: ajax
function ajax()
{
if (!$this->input->is_ajax_request()) {
exit('No direct script access allowed');
} else {
$table = '' . DBPREFIX . 'category';
$primaryKey = 'id_category';
$columns = array(array('db' => 'id_category', 'dt' => 'id_category'), array('db' => 'category_name', 'dt' => 'category_name'), array('db' => 'id_category', 'dt' => 'action', 'formatter' => function ($id) {
return '<a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/view/' . $id) . '" target="_blank" class="btn btn-info btn-xs">View</a> <a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/update/' . $id) . '" class="btn btn-primary btn-xs">Update</a> <a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
}));
$sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
$this->output->set_content_type('application/json')->set_output(json_encode(Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns), JSON_PRETTY_PRINT));
}
}
示例3: ajax
function ajax()
{
if (!$this->input->is_ajax_request()) {
exit('No direct script access allowed');
} else {
$table = '' . DBPREFIX . 'session';
$primaryKey = 'id';
$columns = array(array('db' => 'id', 'dt' => 'id'), array('db' => 'ip_address', 'dt' => 'ip_address'), array('db' => 'timestamp', 'dt' => 'timestamp', 'formatter' => function ($str) {
return dateHourIconPrivate(date('Y-m-d H:i:s', $str));
}), array('db' => 'data', 'dt' => 'data', 'formatter' => function ($str) {
return '<textarea style="margin: 0px;height: 150px;width: 350px;">' . preg_replace("/[s:]+[0-9]+[:]/", '', preg_replace("/^.+\n/", "", str_replace(';', "\n", str_replace('|', ' : ', $str)))) . '</textarea>';
}), array('db' => 'id', 'dt' => 'action', 'formatter' => function ($id) {
return '<a href="' . base_url('' . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/delete/' . $id) . '" class="btn btn-danger btn-xs">Delete</a>';
}));
$sql_details = array('user' => $this->db->username, 'pass' => $this->db->password, 'db' => $this->db->database, 'host' => $this->db->hostname);
$this->output->set_content_type('application/json')->set_output(json_encode(Datatables::simple($_GET, $sql_details, $table, $primaryKey, $columns), JSON_PRETTY_PRINT));
}
}