我試圖在我的列表中添加搜索。我正在使用codeigniter和分頁列表。搜索只是數據庫搜索的示例ID。該搜索在分頁的第一頁中完美呈現。但是當涉及到其他頁面時,它不起作用。搜索在codeigniter中無法使用分頁
這是我的控制器的代碼。
$this->clear_sample_id_catche();
$out=$this->Mgeneral->listData();
$per_page = 10;
$total = $this->Mgeneral->countData();
$data = $this->Mgeneral->listData($per_page, $this->uri->segment(3));
$base_url = site_url('general/listData');
$config['base_url'] = $base_url;
$config['total_rows'] = $total;
$config['per_page'] = $per_page;
$config['uri_segment'] = '3';
$this->pagination->initialize($config);
$data=array('body'=>'list','out'=>$data);
$this->load->view('template',$data);
我添加了表單來搜索我的視圖。 任何人都可以提出我的問題是什麼? 在此先感謝。
我沒有看到您的代碼中的任何搜索參數,我認爲這是您可能通過發佈數據使用它的問題,但codeigniters分頁是重定向基礎,因此您在下一次請求時失去了搜索參數。 – 2012-04-16 07:24:51
用於分頁搜索,您必須使用get方法或將張貼的搜索參數存儲在表單中的隱藏字段中,因此下一頁將攜帶搜索參數 – Broncha 2012-04-16 07:29:09