因此,我有一個列出銷售線索的頁面,該頁面有一個用戶提交的過濾器表單,用於過濾列表,以便僅顯示他們選擇的數據作爲過濾標準),它也有分頁,每當我使用分頁(如點擊其中一個鏈接),然後使用過濾器,過濾器不起作用,我覺得問題存在於base_url配置中分頁或uri_segment,因爲當我張貼過濾器數據時,它應該調用一個函數(過濾器),它顯然會將最後一個uri段從「list」更改爲「filter」,當我不使用分頁時,但是當我使用它,然後使用過濾器它只是追加'過濾器'到最後,所以我最終與'列表/過濾器'這是不正確的,我怎麼能解決這個問題? :s我嘗試刪除/更改uri_segment,有無論如何我可以修改分頁配置的base_url變量,以使其工作? 另外,當我點擊任何不是第一頁的鏈接時,結果數顯示在我的uri中,這會影響任何內容嗎?CodeIgniter:分頁不會允許我通過發佈表單來更改功能
相關代碼: 控制器:
public function lists($offset = 0) {
$this->load->library('pagination');
$limit = 13;
$this->load->model('listsalemod'); //load the model that contains the database functionality.
$lead = $this->listsalemod->listlead($limit, $offset); //load the function that lists leads and pass it to a variable
$cli = $this->listsalemod->listcli(); //load the function that lists clents and pass it to a variable
$data = array(); //create an array
$data['lead'] = $lead['records']; //pass lead data to array
$data['cli'] = $cli; //pass client data to array
$config['base_url'] = site_url('list_sales/lists');
$config['total_rows'] = $lead['count'];
$config['per_page'] = 13;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
$this->load->library('pagination');
$data['pagination'] = $this->pagination->create_links();
$this->load->view('list_sales', $data); //load the view and pass in the data.
查看:
<body>
<div id="container">
<form method="post" action="filter">
BFstaff <input type=text name="staff">
date: <input type=text name="date">
Client <input type=text name="client">
<input type="submit" value="submit">
</form>
<table id="table">
<tr>
<th>short description</th>
<th>Client</th>
<th>Created</th>
<th>view</th>
<div id="pagination">
<?php
echo $pagination;
?>
預先感謝您。