Welcome Guest, Not a member yet? Register   Sign In
Pagination with tabs
#1

[eluser]d_ni[/eluser]
Hi to all

I'm trying to use the pagination library with a jquery tabs, but I don't know how to use more than one pagination at same page (now all tabs are paginated with the same page, if the tab1 is at page 2, all tabs are in page 2).

Any idea?

I think it is the same as to have more than one <div> paginated.


Thanks!

#2

[eluser]Patrick Spence[/eluser]
[quote author="d_ni" date="1351904973"]Hi to all

I'm trying to use the pagination library with a jquery tabs, but I don't know how to use more than one pagination at same page (now all tabs are paginated with the same page, if the tab1 is at page 2, all tabs are in page 2).

Any idea?

I think it is the same as to have more than one <div> paginated.


Thanks!

[/quote]

You could always split render the returned data from your data query and load that into tabs..

You aren't at the mercy of the pagination library, all it really does for you is render the links right?

So, if you want, for example, 20 rows of data in each tab.. and you want to have say 5 tabs on a page, just grab 100 rows per request, and chunk out 20 per tab.

Which brings up the question, if you are loading data into tabs, why do you need the pagination library? Unless you want to load an actual real page into each tab, and your data volume is low enough, you wouldn't even need pagination.

Another option, and probably easier, would be to configure the links to be the right CSS layout to -look- like tabs..so that it emulates the tabs but in reality just switches pages like the pagination library does normally.
#3

[eluser]d_ni[/eluser]
[quote author="Patrick Spence" date="1351910214"][quote author="d_ni" date="1351904973"]Hi to all

I'm trying to use the pagination library with a jquery tabs, but I don't know how to use more than one pagination at same page (now all tabs are paginated with the same page, if the tab1 is at page 2, all tabs are in page 2).

Any idea?

I think it is the same as to have more than one <div> paginated.


Thanks!

[/quote]

You could always split render the returned data from your data query and load that into tabs..

You aren't at the mercy of the pagination library, all it really does for you is render the links right?

So, if you want, for example, 20 rows of data in each tab.. and you want to have say 5 tabs on a page, just grab 100 rows per request, and chunk out 20 per tab.

Which brings up the question, if you are loading data into tabs, why do you need the pagination library? Unless you want to load an actual real page into each tab, and your data volume is low enough, you wouldn't even need pagination.

Another option, and probably easier, would be to configure the links to be the right CSS layout to -look- like tabs..so that it emulates the tabs but in reality just switches pages like the pagination library does normally.[/quote]

Hi,
Thanks for your fast reply.

This is not the idea, I'm trying to paginate diferent data (tables) in each tab, one example may be cars: first tab; electric cars, second tab; diesel, etc and I need this tabs paginated.

Thanks!
#4

[eluser]PhilTem[/eluser]
You need to do the pagination manually i.e. dump CI's pagination library and get the pages via $_GET parameters (or segments, but $_GET is easier). You would also need to pass along a parameter to know which table you wanna paginate.

CI's pagination lib only works for very very simple and basic pagination problems Wink
#5

[eluser]d_ni[/eluser]
[quote author="PhilTem" date="1351949080"]You need to do the pagination manually i.e. dump CI's pagination library and get the pages via $_GET parameters (or segments, but $_GET is easier). You would also need to pass along a parameter to know which table you wanna paginate.

CI's pagination lib only works for very very simple and basic pagination problems Wink[/quote]

Ok Ok

Thanks!!!
#6

[eluser]d_ni[/eluser]
Hi to all,

Finally, I did it with the CI pagination library.

I decided to use one uri_segment for each tab and prefix, suffix and first_url options as:

First Tab:
Code:
$this->load->library('pagination');
$config['base_url'] = base_url()."index";
$config['total_rows'] = $num_rows;
$config['per_page'] = $per_page;
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$config['page_query_string'] = FALSE;
$config['uri_segment'] = 3;
$config['prefix'] = "";
$config['suffix'] = "/".$this->uri->segment(4)."/".$this->uri->segment(5)."/";
$config['first_url'] = $base_uri."/0/".$this->uri->segment(4)."/".$this->uri->segment(5)."/";
$this->pagination->initialize($config);
$this->pagination->create_links();

Second Tab:
Code:
$this->load->library('pagination');
$config['base_url'] = base_url()."index";
$config['total_rows'] = $num_rows;
$config['per_page'] = $per_page;
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$config['page_query_string'] = FALSE;
$config['uri_segment'] = 4;
$config['prefix'] = "/".$this->uri->segment(3)."/";
$config['suffix'] = "/".$this->uri->segment(5)."/";
$config['first_url'] = $base_uri."/".$this->uri->segment(3)."/0/".$this->uri->segment(5)."/";
$this->pagination->initialize($config);
$this->pagination->create_links();

Third Tab
Code:
$this->load->library('pagination');
$config['base_url'] = base_url()."index";
$config['total_rows'] = $num_rows;
$config['per_page'] = $per_page;
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$config['page_query_string'] = FALSE;
$config['uri_segment'] = 5;
$config['prefix'] = "/".$this->uri->segment(3)."/".$this->uri->segment(4)."/";
$config['suffix'] = "";
$config['first_url'] = $base_uri."/".$this->uri->segment(3)."/".$this->uri->segment(4)."/0/";
$this->pagination->initialize($config);
$this->pagination->create_links();
#7

[eluser]Patrick Spence[/eluser]
[quote author="d_ni" date="1351976795"]Hi to all,

Finally, I did it with the CI pagination library.

I decided to use one uri_segment for each tab and prefix, suffix and first_url options as:

First Tab:
Code:
$this->load->library('pagination');
[/quote]

Excellent, I am glad you got it working.

Another method, and one more complex but more seemless to your users would be to load the data via javascript into the tabs themselves.. when you deal with larger chunks of data to present, sometimes you just want the first page to be downloaded at first.




Theme © iAndrew 2016 - Forum software by © MyBB