gridcn2.0.0
Data modes

Troubleshoot server data

Find the cause of missing rows, a wrong page count, lost edits, or a lost selection in a grid that loads rows from your server, and fix it.

Find your symptom below. In a development build, the grid logs a warning for several of these causes. It starts with [data-grid] or the add-on name, such as [data-grid-server]. Read the console first.

Rows are wrong or missing

  • A header click selects the column and does not sort. Without totalRowCount, headerClickBehavior is "select". Set headerClickBehavior="sort".
  • The grid sorts or filters the rows again. Without useDataGridServerRows, the grid sorts and filters its data. Set sortMode="server" and filterMode="server".
  • status is "error" and the grid shows the last good rows. fetchRows rejected, threw, or resolved without a rows array. Fix the cause, then call server.retry() or select Retry in the error bar.
  • A page shows fewer rows than pageSize. The answer repeats a row id, and the hook drops the later copies. Make the sort order unique.
  • Your route answers 400 with a ServerSpecError message. parseServerSpec rejected the body, and the message names the part, for example filters[2].value. Fix the value that the client sends, or your columns and limits. See Check the spec on your server.
  • A number or date filter matches the wrong rows. Every filter value is text, such as "5". Convert it on your server for number and date columns. See Operators.
  • A pushed row stays in its old place. With a server sort or filter, the grid marks a pushed row stale and never moves it. The hook reshapes one second after the push. Call server.reshape() to reshape at once, or set reshapeDelayMs. See Push into a server-ordered view.
  • Rows at the end of an answer do not show. The answer holds more than end - start rows, and the hook uses the first end - start. Make your server honor the limit.
  • A slow answer replaces a newer page. With your own fetch, abort the request of a replaced page, as Load rows by page does. The hook does it for you when fetchRows passes signal to fetch.

The pager and the count

  • The footer shows "Page 3" in place of a range, and Last stays disabled. The count is unknown. The first answer sent no valid totalRowCount. Send the count of the filtered result.

  • The count stays unknown although the server sends total or hasNextPage. The hook reads totalRowCount and hasMore only. Rename the fields. Development builds warn.

  • The page goes back to page 1. Nothing needs a fix. A change of the page size, the sort, the filter, or the search text gives other pages, so the hook resets the page.

  • The page-size select is missing. With useDataGridServerPager, pass onPageSizeChange.

Edits and saves

  • A failed save does not revert the edit. Your onSave returns no promise and does not throw. Or the grid is readOnly at the refusal and keeps the refused value. Return a promise that rejects or resolves with { rejected }. See Save edits.
  • A row stays marked failed. The mark clears at the next save of the row, or with actions.clearSaveStatus().
  • Two users edit the same row, and the later save overwrites the first. Your server accepts every write. Compare prev with the stored row and refuse the row. See Handle refused saves.
  • A new row keeps its client id after the save. Call actions.replaceRowId(oldId, row) with the server row. See Save edits.

Scroll mode

  • Rows show skeletons for a moment after a scroll. A block starts after it stays in the wanted range for loadDelayMs (default 100). Pass loadDelayMs: 0 to start at once.
  • Rows that you scrolled past load again. maxLoadedRows (default 10,000) unloads the blocks viewed longest ago. Raise it, or pass Infinity. See Tune row retention.
  • The scroll height grows in steps. The source sends no row count, so blocks load one at a time, in order. See Load without row count.
  • One block fails while the others load. The grid keeps the loaded rows and shows an error state. Fix the cause, then call server.retry(). See Recover from load errors.

Selection

Checked rows vanish on a page change, or select all matching does nothing. Both need totalRowCount and checkedRowsLifetime="across-filters", the default with totalRowCount. The hook passes both. With your own fetch, pass totalRowCount to the grid. actions.selectAllMatching() returns the missing one as its reason.

The hook setup

A warning says that the mode changed. The hook cannot switch mode after mount, and React reports a changed hook order. To switch between pages and scroll mode, remount the component with a new key.

On this page