'How to run multiple pagination in single function in codeigniter
I have two tabs inside my view. On first tab there is different pagination on second tab i need to run separate pagination using CI pagination library. I am not able to run more than one instance of pagination by using CI Library.
public function index()
{
$total_rows=$this->caste_model->count_caste_list();
//pagination
$start = ($this->uri->segment(3)?$this->uri->segment(3):0); //start
$per_page=2;
$this->load->library('pagination');
$this->config->load('pagination2', TRUE);
$config = $this->config->item('pagination2');
$config['uri_segment'] = 3; //uri segment
$config['base_url'] = site_url("caste/index");
$config['total_rows'] = $total_rows;
$config['per_page'] = $per_page;
$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$data['links'] = $this->pagination->create_links();
$data['castes']=$this->caste_model->caste_list($per_page,$start);
$data['religions']=$this->caste_model->religion_list();
$this->layout('settings/caste&religion/add',$data);
}
Solution 1:[1]
In CodeIgniter, you can't run two paginations in one view. Because it deals with URL and once the first pagination navigates then the second pagination (bottom of the same page) will also respond according to that.
To avoid this use Bootstrap 3 datatables for one paginations .(use it to low weight part to load site fast.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abdulla Nilam |
