hurt-tomatoH
Refine3y ago
25 replies
hurt-tomato

Clientside Pagination Total Count

Hello,
const ItemsList = () => {
  const { dataGridProps, tableQueryResult } = useDataGrid({
    resource: 'items',
    meta: {
      fields: ['id', 'name'],
    },
    pagination: {
      mode: 'client',
    },
  })

  const { data, isLoading, isError } = tableQueryResult

  const items = data?.data ?? ''

  if (isLoading) {
    return <div>Loading...</div>
  }

  if (isError) {
    return <div>Something went wrong!</div>
  }

  if (items) {
    return (
      <div style={{ width: '100%' }}>
        <h1>Items</h1>
        <List>
          <DataGrid {...dataGridProps} columns={columns} autoHeight />
        </List>
      </div>
    )
  }
  return <></>
}

When I do client-side pagination, the total count appears as 0. It shows as 0 - 0 of 0. When I manually try to pass it, the data.length value is the same as the current page size and not the total. Does anybody have any ideas what I'm doing wrong? I tried passing more props to the useDataGrid but it still doesn't work. Thank you!
Was this page helpful?