JPagination refelcting same limit value for two lists

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
rajan416
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Jan 13, 2011 5:14 am

JPagination refelcting same limit value for two lists

Post by rajan416 » Fri May 20, 2011 10:36 am

I am using two lists/grids in single page .. i have used 2 Jpagination control and am having 2 limit values for respective list/grids .

my issue is when i try to change the limit value of the first list/grid , it affects the second list/grid limit value.

I found the issue is due to both first and second limit dropdown is having same "id" value due to Jpagination

My question is: how can i override the limit id , when we use more than 2 Jpagination for 2lists/grids in a single page?

rajan416
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Jan 13, 2011 5:14 am

Re: JPagination refelcting same limit value for two lists

Post by rajan416 » Tue May 24, 2011 4:45 am

any idea on this?

almooj-craig
Joomla! Guru
Joomla! Guru
Posts: 500
Joined: Mon Aug 11, 2008 3:05 pm

Re: JPagination refelcting same limit value for two lists

Post by almooj-craig » Tue May 24, 2011 5:38 am

You should be using two forms, one for each pagination.

rajan416
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Jan 13, 2011 5:14 am

Re: JPagination refelcting same limit value for two lists

Post by rajan416 » Tue May 24, 2011 7:25 am

I am using this function for $this->pagination->getListFooter() for both grids inside a single form..I have also tried 2 forms... its not working

almooj-craig
Joomla! Guru
Joomla! Guru
Posts: 500
Joined: Mon Aug 11, 2008 3:05 pm

Re: JPagination refelcting same limit value for two lists

Post by almooj-craig » Tue May 24, 2011 1:25 pm

First you will need to store the values for the limit and limitstart for each of your data sets in the session.

Then you need to use two forms with a hidden field type so that when the form is submitted you know which form was used.

When you are building the pagination object that's from the active form you use the limit and limitstart from the JRequest values that have been passed from the form. For the other forms data set you get the values from your session data to build the pagination object.

That way you can have one data set that uses a limit of 10 and is on page 3 and the other one could use a limit of 20 and be on page 7. You could even change the order of each of the data sets independently if you needed.

rajan416
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Jan 13, 2011 5:14 am

Re: JPagination refelcting same limit value for two lists

Post by rajan416 » Wed May 25, 2011 4:58 am

Thanks for the reply.

Tried to create two forms still am getting error.

Because I am using two grid in same page , so how can i create two instance for two pagination control which are all using single function "$this->pagination->getListFooter()".

almooj-craig
Joomla! Guru
Joomla! Guru
Posts: 500
Joined: Mon Aug 11, 2008 3:05 pm

Re: JPagination refelcting same limit value for two lists

Post by almooj-craig » Fri May 27, 2011 5:47 pm

Look through the code of your module or component and find the place where the pagination object is being created. Usually it looks something like:
$pagination = new JPagination( $total, $limitstart, $limit);
or
$this->pagination = new JPagination( $total, $limitstart, $limit);
$this->pagination1 = new JPagination( $total1, $limitstart1, $limit1);

Create a pagination and pagination1 object and for clarity just use the same style of coding that they used to create the single object, but pass different values.

Then you should be able to use:
$this->pagination->getListFooter();
or
$this->pagination1->getListFooter()


Locked

Return to “Joomla! 1.5 Coding”