Pagination only displays the first 10 records - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Pagination only displays the first 10 records (/showthread.php?tid=68727) |
Pagination only displays the first 10 records - Ajax30 - 08-17-2017 I am trying to paginate a Codeigniter 3 application without using the framework's pagination library. More exactly, I want to paginate a table with about 100 rows. For this purpose: In the home controller I have: Code: public function index() { In the Model file I have: Code: class Customer extends CI_Model { Finaly, the view: Code: <div class="pagination-container text-center"> The pagination is displayed and properly formatted; so are the first 10 records: But if I click on page 2, or any other page, I get the same first 10 records as can be seen in the image below: The url of page 2 is: Code: http://localhost/cicrud/index.php?page=2 I did something wrong, I can't understand what. Any help? Thank you! RE: Pagination only displays the first 10 records - Edel - 08-17-2017 I think the problem is in your base_url from pagination library. test this. Code: $config = [ I think that you wil have a problem with limit functionality later. so when you call Code: $this->Customer->getCustomers($config['per_page'], $this->uri->segment($config['uri_segment'])); Code: $this->Customer->getCustomers($config['per_page'], $this->uri->segment($config['uri_segment'])*$config['per_page']); RE: Pagination only displays the first 10 records - Wouter60 - 08-17-2017 (08-17-2017, 12:05 AM)Ajax30 Wrote: I am trying to paginate a Codeigniter 3 application without using the framework's pagination library.Is this correct? Everything indicates that you ARE using CI's pagination library... RE: Pagination only displays the first 10 records - Edel - 08-18-2017 if you use $this->pagination->initialize($config), $this->pagination->create_links(), you are using codeigniter´s pagination library. what´s the url of your first pagination page? Also, the limit function first parameter should be per_page, and the second the number of row to start listing = (page-1)*per_page. |