在grocery-crud中是否有仅导出两列的选项。我不想导出所有列。
发布于 2014-05-10 15:20:25
正确的方法是使用getState()方法
$state = $crud->getState();
if ($state == 'export' || $state == 'print') {
$crud->columns('first_name','last_name','email');
} else {
$crud->columns('first_name','last_name','email','phone','city','country');
}下面是完整的代码示例:
function example1()
{
$crud = new grocery_CRUD();
$crud->set_table('customers');
$crud->set_subject('Customer');
$crud->required_fields('first_name', 'last_name','email');
$state = $crud->getState();
if ($state == 'export' || $state == 'print') {
$crud->columns('first_name','last_name','email');
} else {
$crud->columns('first_name','last_name','email','phone','city','country');
}
$output = $crud->render();
$this->_example_output($output);
}https://stackoverflow.com/questions/23541354
复制相似问题