Views total pages

Created on 27 August 2023, about 1 year ago
Updated 25 January 2024, 8 months ago

Problem/Motivation

Is there a way to retrieve the total number of pages when running an query on a view. Below is my query

query SearchContent($search_text: String, $page: ID) {
  entityById(entityType: VIEW, id: "search_content") {
    ... on View {
      executable(displayId: "default") {
        ... on ViewExecutableSearchContentDefault {
          execute(
            searchApiFulltext: $search_text
            page: $page
          ) {
            rows {
              id
              label
            }
          }
        }
      }
    }
  }
}

But I can't find the field to put to retrieve the total number of pages

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇲🇺Mauritius whiz11

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @whiz11
  • 🇲🇺Mauritius whiz11

    Adding a patch to fix this on the beta5 release. It will then work as follows

    query SearchContent($search_text: String, $page: ID) {
      entityById(entityType: VIEW, id: "search_content") {
        ... on View {
          executable(displayId: "default") {
            ... on ViewExecutableSearchContentDefault {
              execute(
                searchApiFulltext: $search_text
                page: $page
              ) {
                rows {
                  id
                  label
                }
                total_rows
              }
            }
          }
        }
      }
    }
  • 🇨🇭Switzerland ayalon

    Thanks for your patch! I have added the total row field and also found another bug while dealing with translations on a view with search api backend.

    This has now been fixed and commited.

  • Status changed to Fixed 8 months ago
    • ayalon committed b90f7311 on 1.0.x
      Issue #3383626 by whiz11, ayalon: Views total pages
      
  • Status changed to Fixed 8 months ago
Production build 0.71.5 2024