[Drupal] How to fix the incorrect pager display in drupal 7?

| | 1 min read

In a recent project, I had to make use of pagers in two views. As per the requirement, I had to display different numbers of contents per page for both views. For the first view, I had to display 2 items per page and for the second one(search-results view) 10 per page.The problem I faced was, Eventhough if I had less than 10 search results, the page displayed the pager-links as per the contents of the first view. ie, both the views showed same number of pagers, which was wrong. If you want to know, how I fixed this, please read on.

This issue occured because, both the views had the same pager-id.'Pager id' in a view is used to distinguish the pagers in the site. So, if two pagers have the same pager-id, there will arise a confusion which results in the wrong display of pagers.The solution to this problem is to change the value of 'pager-id' for both views.You can change the pager id by clicking on your pager items link.

For eg: Say you are using a mini -pager,

  • Click on minipager link in the pager block of your view.
    pager1.png
  • Now you will see Pager options window. There is a Pager Id field. By default, this will be zero.
    pager2.png
  • Change this value to a higher one

This will help you to solve your problem regarding the pager display.Hope this helps