CodeIgniter Forums
Pagination after filter doesn't work??? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Pagination after filter doesn't work??? (/showthread.php?tid=26940)



Pagination after filter doesn't work??? - El Forum - 01-27-2010

[eluser]123wesweat[/eluser]
hi there,

I am able to get the regular pagination to work, but not with a filter. Let me clarify:
I have a list of artworks and the pagination works (now per page 5 items). But when i filter the arworks by category and i call a seperate function to get the right category and show the results, the pagination library seems to skip the per_page config setting. The num_links does work, when i have a total of 17 items it shows 4 num links.

But the page overview shows all 17 items.

Code:
//pagination
          $config['base_url'] = 'mydomain.com/artworks/art_category_overview/';
          $config['total_rows'] = $this->jobs_model->get_job_of_sort($sortJob)->num_rows();
          echo $config['total_rows'];
          /*die();*/
          $config['per_page'] = '5';
          $config['num_links'] = '1';
          $config['full_tag_open'] = '<div id="pagination">';
          $config['full_tag_close'] = '</div>';

          $this->pagination->initialize($config);

Any ideas where i should look??


Pagination after filter doesn't work??? - El Forum - 01-27-2010

[eluser]123wesweat[/eluser]
ok i have the per page ready but still the pagination doesn't work correctly. The links haven't got the right href's.

The pagination keeps highlighting the first nav. so link ">" doesn't work correctly.

the base url is
Code:
$config['base_url'] ='mydomain.com/artworks/artwork-category/'.$cat_art.'/'


for the per_page i have added this function
Code:
$cat_art= $this->uri->segment(3);
          $offsetArts = $this->uri->segment(4);

    function get_artworks_of_sort_limit($per_page,$offsetArts,$cat_art) {
         $this->db->select('id');
         $this->db->select('title');
         $q = $this->db->where('functie', $cat_art)->get('fs_vacatures', $per_page,$offsetArts);
         return $q;
    }



Pagination after filter doesn't work??? - El Forum - 01-27-2010

[eluser]123wesweat[/eluser]
i think i found the solution
http://ellislab.com/forums/viewthread/138916/

$config['uri_segment'] = 4;