Problem with Views Pager

Wed, Jan 30, 2013 2-minute read

This one is funny.
Today I discovered that my page, created with multiple views, and each view with its own pager works weird. Clicking on one pager will affect all other pagers on the page –> click on one change value to all of them.

Little research and I found that I need to change pager ID inside my view.

Views pager settings

As it is visible on above image there is place to change ID. I did that (changed ID's to 0, 100, and 110) and in a second problem was solved… Kind of.

It was solved from perspective that one pager doesn’t affect another one but suddenly my URL changed to something like this:

/all?field_question_category_tid=All&page=1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,2
(110 commas in total)

AAAAAAAAAAAAAAA, what the hack is this.

Return back to the view and noticed small details inside text under ID field:
“Unless you're experiencing problems with pagers related to this view, you should leave this at 0. If using multiple pagers on one page you may need to set this number to a higher value so as not to conflict within the ?page= array. Large values will add a lot of commas to your URLs, so avoid if possible.”

Important part of this text: “Large values will add a lot of commas to your URLs, so avoid if possible.”

So I changed ID’s to 0,1,2 and my pager returned to something normal like this:

    /all?field\_question\_category\_tid=All&page=1,1,2  

Cool :-)