a!gridField returning error: A grid component [label=“”] has an invalid value for “value” and “totalCount”. “startIndex” must not be greater than “totalCount”, but “startIndex” was 51 and “totalCount” was 0.

Hi guys,

We're facing a bit of an issue in one of our gridFields. We have a search tab which retrieves and displays results in a gridField from an API. It searches and displays fine, but if we page past the first page and try to show 0 results (either by pressing a "Clear" button to clear the search or by searching for something with 0 results) we get the following error:

A grid component [label=“”] has an invalid value for “value” and “totalCount”. “startIndex” must not be greater than “totalCount”, but “startIndex” was 51 and “totalCount” was 0.

It seems to be caused by the startIndex not being reset, but as far as I know a!gridField should be handling this automatically. The gridField is populated with the following data:

if(
    rule!CMN_isBlank(
      local!searchResultData
    ),
    null,
    a!dataSubset(
      data: local!searchResultData,
      totalCount: local!metaData.totalRecords,
      startIndex: ri!searchParameters.startIndex,
      batchSize: ri!searchParameters.batchSize,
      sort: a!sortInfo(
        field: ri!searchParameters.sortColumn,
        ascending: ri!searchParameters.sortOrder
      )
    )
)


The local variables are all derived from the search response. To reduce load, the API we query only returns a max of 50 records at a time and a totalCount field. The totalCount field allows us to display the full number of results that match the query/allows the user to paginate. When we page, we query the API again for the next batch of results. Is there something wrong with the way we're trying to handle this which is causing our issue?

Thanks for any help, would really appreciate any insights into what's causing this problem.

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data