本文整理汇总了PHP中Datatable::add_entries方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatable::add_entries方法的具体用法?PHP Datatable::add_entries怎么用?PHP Datatable::add_entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datatable
的用法示例。
在下文中一共展示了Datatable::add_entries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_datatables_ajax
/**
* ajax-based serverside processed datatables example action
*/
public function action_datatables_ajax()
{
// Column definition
$columns = array("test1" => "Testcolumn #1", "test2" => "Testcolumn #2");
// Generate random data
$data = Session::instance()->get('dattables_example', array());
if (empty($data)) {
for ($i = 0; $i < 5000; $i++) {
$data[] = array('test1' => $this->generateRandomString(25), 'test2' => $this->generateRandomString(25));
}
}
// Create datatable
$datatable = new Datatable($columns);
// Here you could also pass in a orm model like this: $datatable->add_entries(ORM::factory('Model'));
// Then the model needs to have columns named like the keys in the column definition, so in this example
// test1 and test2 are needed properties on the model.
$datatable->add_entries($data);
$datatable->set_serverside(URL::base() . 'UIFWExamples/datatables_ajax');
// Render html code from datatable->render() with the html layout
if (Request::$current->is_ajax()) {
echo $datatable->ajax_render();
} else {
$this->renderHtml($datatable->render());
}
}