TanStackT
TanStack13mo ago
1 reply
sacred-emerald

Empty getRowModel() rows despite having data

Hi I've been using the tanstack table but I did a lot of server side pagination, filtering, and sorting. I have a boolean field called hidden and I do filter these on the backend. It's all working with the api and I can see that the data is passed on to the DataTable. The getRowModel() function returns empty rows still, wondering if I am missing something or did some weird config. Here is the sample of my implementation:
let tableConfig: TableOptions<DataWithOnClick<TData>> = {
    data,
    columns,
    filterFns: {},
    getCoreRowModel: getCoreRowModel(),
    getPaginationRowModel: getPaginationRowModel(),
    onColumnFiltersChange: setColumnFilters,
    getSortedRowModel: getSortedRowModel(),
    getFilteredRowModel: getFilteredRowModel(),
    onColumnVisibilityChange: setColumnVisibility,
    getFacetedRowModel: getFacetedRowModel(), // client-side faceting
    getFacetedUniqueValues: getFacetedUniqueValues(), // generate unique values for select filter/autocomplete
    getFacetedMinMaxValues: getFacetedMinMaxValues(), // generate min/max values for range filter
    state: {
      columnFilters,
      columnVisibility,
    },
  };

  if (manualPagination) {
    tableConfig = {
      ...tableConfig,
      manualPagination,
      onPaginationChange,
      rowCount,
      state: {
        ...tableConfig.state,
        pagination,
      },
    };
  }

  if (manualSorting) {
    tableConfig = {
      ...tableConfig,
      manualSorting,
      onSortingChange,
      state: {
        ...tableConfig.state,
        sorting,
      },
    };
  }

  const table = useReactTable(tableConfig);
Was this page helpful?