Problem/Motivation

I have an odd issue. I have pager serializer in use on multiple views, the total_items on one of them is not working correctly. Here is the pager result for page 1 of the view where total is incorrect:

"pager": {
  "current_page": 1,
  "total_items": 21,
  "total_pages": 3,
  "items_per_page": 10
}

The actual total is 47, but on each page the total_items changes, e.g. page 3 indicates there are 41 total_items (total_pages is also incorrect and changes per page).

Here is an example where the total items are correct (same site, different View)

"pager": {
  "current_page": 1,
  "total_items": "26",
  "total_pages": 3,
  "items_per_page": 10
}

Notice that total_items here is a string... total_items and total_pages are consistent and correct across page numbers for this view.

I can typically figure this kind of thing out on my own, but this one has me pretty stumped. Any ideas on directions to explore would be greatly appreciated.

Additional notes:
- the fact that the first total_items is an int and the second is a string made think we could be changing the value in a hook somewhere, but I can't find anything like that in code (though I am not even sure what that hook would look like and we have a couple hundred thousand lines of custom code, so... )

- both views use a custom entity as base entity with multiple relationships and contextual filters

Steps to reproduce

unknown

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DanStorm created an issue. See original summary.

davidwhthomas’s picture

I'm not sure if it's the same for your case, but I had to choose the "full" pager in the view and not the "mini" pager. Then the pagination data was correct. Otherwise the values changed each page.

bluegeek9 made their first commit to this issue’s fork.

bluegeek9’s picture

Status: Active » Fixed
Issue tags: -total items

The page needs to be full. I updated the README and the homepage.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.