javascript - Best way to do multiple pagination on one page in codeigniter - Stack Overflow

I have seen a number of old posts around this topic on stack overflow but none of them seem to give any

I have seen a number of old posts around this topic on stack overflow but none of them seem to give any clarity. What I have understood by going through them is that codeigniter doesnt support multiple paginations through its class and that you have to write your own class.

I wonder if that is the case. In case any body here has an idea about how to do it please let me know. I have three lists which I'm passing into the view. However when I paginate all of them, all the three lists response to same page offset. Is Ajax_pagination the way out?

Please suggest how to do this.

UPDATE: Here is my code and what I'm trying to do.This is a view file. I have two lists 1. org_list 2. Ind_list I'm trying to pass to these two lists in tow view files (organization_listing, individual_listing) both of which are loaded in this view file and therefore appear on the same page. Now I can paginate one list but when I paginate the second file they both respond to same uri offset.

I'm generating the pagination links in the (organization_listing, individual_listing) view files.

<?php 

    $config['base_url'] = 'http://localhost/socialinew/user_registration/index.php/members_area/view_members_area';
    $config['total_rows'] = count($org_list);
    $config['per_page'] = 4;
    $config['num_links'] = 20;
    $config['full_tag_open'] = '<div id="pagination3">';
    $config['full_tag_close'] = '</div>';

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

    for($i=$this->uri->segment(3)+0;$i<(($this->uri->segment(3)+$config['per_page']));$i++)
    {
        if(isset($org_list[$i]))
        {$temp_org[$i]=$org_list[$i];
        }


    }

    $tmp_org['org_list']=$temp_org;


$this->load->view('organization/organization_listing',$tmp_org);



    $org_config['base_url'] = 'http://localhost/socialinew/user_registration/index.php/members_area/view_members_area/';
    $org_config['total_rows'] = count($ind_list);
    $org_config['per_page'] = 5;
    $org_config['num_links'] = 20;
    $org_config['full_tag_open'] = '<div id="pagination2">';
    $org_config['full_tag_close'] = '</div>';

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

    for($i=$this->uri->segment(4)+0;$i<(($this->uri->segment(4)+$config['per_page']));$i++)
    {
        if(isset($ind_list[$i]))
        {$temp_ind[$i]=$ind_list[$i];
        }
    }

        $tmp_ind['ind_list']= $temp_ind;    

$this->load->view('individual_listing',$tmp_ind);?>

I have seen a number of old posts around this topic on stack overflow but none of them seem to give any clarity. What I have understood by going through them is that codeigniter doesnt support multiple paginations through its class and that you have to write your own class.

I wonder if that is the case. In case any body here has an idea about how to do it please let me know. I have three lists which I'm passing into the view. However when I paginate all of them, all the three lists response to same page offset. Is Ajax_pagination the way out?

Please suggest how to do this.

UPDATE: Here is my code and what I'm trying to do.This is a view file. I have two lists 1. org_list 2. Ind_list I'm trying to pass to these two lists in tow view files (organization_listing, individual_listing) both of which are loaded in this view file and therefore appear on the same page. Now I can paginate one list but when I paginate the second file they both respond to same uri offset.

I'm generating the pagination links in the (organization_listing, individual_listing) view files.

<?php 

    $config['base_url'] = 'http://localhost/socialinew/user_registration/index.php/members_area/view_members_area';
    $config['total_rows'] = count($org_list);
    $config['per_page'] = 4;
    $config['num_links'] = 20;
    $config['full_tag_open'] = '<div id="pagination3">';
    $config['full_tag_close'] = '</div>';

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

    for($i=$this->uri->segment(3)+0;$i<(($this->uri->segment(3)+$config['per_page']));$i++)
    {
        if(isset($org_list[$i]))
        {$temp_org[$i]=$org_list[$i];
        }


    }

    $tmp_org['org_list']=$temp_org;


$this->load->view('organization/organization_listing',$tmp_org);



    $org_config['base_url'] = 'http://localhost/socialinew/user_registration/index.php/members_area/view_members_area/';
    $org_config['total_rows'] = count($ind_list);
    $org_config['per_page'] = 5;
    $org_config['num_links'] = 20;
    $org_config['full_tag_open'] = '<div id="pagination2">';
    $org_config['full_tag_close'] = '</div>';

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

    for($i=$this->uri->segment(4)+0;$i<(($this->uri->segment(4)+$config['per_page']));$i++)
    {
        if(isset($ind_list[$i]))
        {$temp_ind[$i]=$ind_list[$i];
        }
    }

        $tmp_ind['ind_list']= $temp_ind;    

$this->load->view('individual_listing',$tmp_ind);?>

Share Improve this question edited Jun 22, 2012 at 15:46 yash asked Jun 22, 2012 at 10:49 yashyash 1833 silver badges12 bronze badges 2
  • Can you give an example of exactly what you are trying to achieve? – MikeCruz13 Commented Jun 22, 2012 at 12:41
  • If you do not like ajax ... you can use iframes. – csotelo Commented Jun 22, 2012 at 14:41
Add a ment  | 

2 Answers 2

Reset to default 1

If you want

1 2 3 4

 results

1 2 3 4

 results

I'm fairly certain it's pretty straight forward:

  1. just configure for the first set (say to use uri segment 3)
  2. Initialize the pagination
  3. Create the links; and
  4. Send it to the view.

Then

  1. Configure for the second set (say to use uri segment 4)
  2. Initialize the pagination
  3. Create the links; and
  4. Send it to the view.

Guys I have finally used javascript to load my individual paginations into the page, so I'm sending my paginations into three different views and then using javascript to call those views into the page. Couldnt figure out any way to do multiple paginations on the same page.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745260008a4619168.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信