I have 2 tables with pagers on one of my pages. I generate the pagers like this:

For the first table:
$rendered_table .= theme('pager', array('tags' => array(), 'element' => 0, 'parameters' => array('tab' => 'one')));

For the second table:
$rendered_table .= theme('pager', array('tags' => array(), 'element' => 1, 'parameters' => array('tab' => 'two')));

This generates correct links for the pagers on the initial load.

For the first table 3rd pager link renders as: http://example.com/contact?tab=one&page=3
For the second table 3rd pager link renders as: http://example.com/contact?tab=two&page=3

When I click any pager link, say the 2nd pager link for the first table, it takes me to the page http://example.com/contact?tab=one&page=2

Now, if you observe the pager links for the first and the second table, both have the 'tab' query set to 'one'.

The issue here is the current url query parameter overrides the parameters option requested via the theme_pager function for the second table.

A simple modification to the theme_pager_link should resolve this issue.
Patch attached.

CommentFileSizeAuthor
#2 pager-1786724-2.patch454 bytesrayasa
pager.inc_.patch439 bytesrayasa

Comments

Status: Needs review » Needs work

The last submitted patch, pager.inc_.patch, failed testing.

rayasa’s picture

Status: Needs work » Needs review
StatusFileSize
new454 bytes

retrying...

mondrake’s picture

see also #1588138: pager_query_add_page() [in D7, theme_pager_link()] overrides parameters passed programmatically and #1778990: Merge theme_pager_link*() theme functions into theme_link().

just fyi, the contributed module Pagerer fixes this if enabling the adaptive pager, which replaces the core theme_pager_link function.

rayasa’s picture