Welcome Guest, Not a member yet? Register   Sign In
Where atre the First and Last links in CI pagination and why cannot go back to first page?
#1

[eluser]ppockey[/eluser]
Where are the First and Prev links in CI pagination and why cannot go back to first page?
#2

[eluser]Dam1an[/eluser]
There really is no need to double post

And you might want to post the code you have so far, so people can spot any problems with it
#3

[eluser]ppockey[/eluser]
Thanks for the reply.
Here's the code in my controller.
The links are displayed in my view, but no 'First' and no 'Prev' and no way to get back to the first page of results.
Thanks.

Code:
function index() {
$this->load->library('table');        
        $this->load->library('pagination');

        $config['base_url'] = base_url().'index.php/admin/attendants/index/';
        $config['total_rows'] = $this->db->count_all('ATTENDANT_DETAIL');
        $config['per_page'] = 10;
        
        $config['num_links'] = 4;
        
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        
        $config['prev_link'] = 'Prev';
        $config['next_link'] = 'Next';
        
        $config['first_link'] = 'First';
              
        $config['last_link'] = 'Last';
                
        $this->pagination->initialize($config);
        
       // GET REQUIRED DATA
        #################################################
        $data['att_data'] = $this->m_admin_attendants->get_att_data( $config['per_page'], $this->uri->segment(4) );        
        
        //VIEWS
        #################################################
        $data['main'] = 'admin/attendant_display';
        $this->load->view('admin/dashboard_template',$data);    
    }
#4

[eluser]Dam1an[/eluser]
First of all, please use [ code ] tags in the future
And secondly, you never seem to call
Code:
$this->pagination->create_links();
#5

[eluser]ppockey[/eluser]
Thanks once again for the reply.
the code create_links() is placed in my view. The page links are created and work, but there are no links to 'First' or 'Prev' and the digit 1 (first page) remains bold and there is no way to go back to the first page of results.

Code:
print $this->pagination->create_links();
// this is what displays
1 2 3 Last >

// this is what I expect to see
First Prev 1 2 3 Next Last

// or even this would be acceptable
« First  < 1 2 3 4 5 >  Last »
#6

[eluser]Unknown[/eluser]
Hello,

I had the same problem, and this I solved it with the $config['uri_segment'] value.

By default, it is 3, so you have to change it accordingly to your application (for me, 4 made everything work ok).

Hope it helps...
#7

[eluser]Markko[/eluser]
[quote author="Micraux" date="1242072797"]I had the same problem, and this I solved it with the $config['uri_segment']value[/quote]

This is old threat but have to say Thank You! I was banging my head for this some time now! Smile
But I got one problem after another!

My pages url is http://www.mysite.com/page/:pagenumber
Now, when clicking first page it goes smae url but no :pagenumber when it should go root url.. How do that?


Thanks for all help.. Smile
#8

[eluser]Tiến Thành[/eluser]
[quote author="Micraux" date="1242058397"]Hello,

I had the same problem, and this I solved it with the $config['uri_segment'] value.

By default, it is 3, so you have to change it accordingly to your application (for me, 4 made everything work ok).

Hope it helps...[/quote]

Thank you, i re-set uri_segment = 4, and now it's working for me.




Theme © iAndrew 2016 - Forum software by © MyBB