![](/img/trans.png)
[英]Grocery CRUD not sorting or searching results and set_model values are not paginated
[英]Searching not happening in grocery crud
在雜貨店中,相關表格不會進行搜索。
搜索僅發生在該表字段中。
function index() {
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('table_name');
$crud->display_as('id','Name');
$crud->callback_column('id', array($this, 'changeName'));
$output = $crud->render();
}
function changeName($value, $row) {
$new = $this->db->select('name')->where('another_table.id', $row->id)->get('another_table')->result();
if(!empty($new)){
return $new[0]->name;
} else {
return $value;
}
}
這里搜索名稱沒有發生。
有人有解決方案嗎?
提前致謝。
嗨@DelvinPaul:我希望你的問題得到解決。 如果它沒有解決,請嘗試使用在changeName
調試您的查詢
log_message('info','Query: '.$this->db->last_query());
log_message('info','Result Returned: '.print_r($new,true));
將這些語句放在changeName函數中的以下行之后:
$new = $this->db->select('name')->where('another_table.id', $row->id)->get('another_table')->result();
並且不要忘記更改$config['log_threshold'] = 3;
在您的配置文件中。 調試后,請更新您的問題以便更清晰,以便我們回答。
采用
$crud->set_theme('datatables');
代替
$crud->set_theme('flexigrid');
你會讓它發揮作用。 此問題僅適用於flexgrid主題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.