SpreadsheetGrid
Guides

Troubleshooting

Common questions (the table doesn't show, edits don't stick, undo is lost, pasted values don't go in, menus can't be pressed inside dialogs or Shadow DOM, 500 on Next.js and more) and known limitations

This page collects common questions and what the current version can't do. For anything not here, ask in GitHub Issues.

Display

The table doesn't show / doesn't scroll

  • Is the CSS loaded? Without import '@ishibashi0112/spreadsheet-grid/style.css', no styles apply and it doesn't scroll.
  • Height: height="100%" follows the parent's height, so the parent needs a definite height (if the parent's height is auto, the grid grows to the height of all rows and virtualization doesn't work). With neither height nor maxHeight, the scroll area is up to 480px tall. Set the height with the height prop, not the root's style.height (Sizing).
  • Inside tabs or modals: while hidden (width 0), the grid doesn't measure its size, and redraws on the next frame after it becomes visible. If it stays empty after becoming visible, check the parent's height.

Column widths don't match width

Columns with flex don't use width (it isn't a minimum either). Write the width you don't want it to shrink below as minWidth. A column whose width was changed by hand keeps that width until you change that column's width / flex / pinned or reset the columns.

Fading a row made it twice as faint

The class and style from getRowClassName go on both the row and each cell in the row. For opacity and the like, return a class and write it for the row only, as in .ssg-body-row.my-muted { opacity: 0.5 }.

Column menus and filters are hidden / can't be pressed inside a dialog

The grid's popups (column menu, column filters, context menu, select options and so on) appear inside the dialog around the grid by default (<dialog> / an element with the popover attribute / role="dialog" / aria-modal="true" and so on) (since 1.1.0. In 1.0.x they went directly under document.body, where they hid behind modals or couldn't be pressed). When your dialog has none of those markers, or you want them elsewhere, pass the place with popupContainer (Use it inside a dialog).

CSS outside a Shadow root doesn't reach inside, so put style.css inside the Shadow root (<style> or adoptedStyleSheets). Popups appear by default inside the element wrapping the grid directly under the Shadow root (since 1.3.0. In 1.2.x they went directly under document.body, had no styles, and tooltips and ↑↓ in menus didn't work). Don't put the grid directly under the Shadow root; wrap it in an element. Use an open Shadow root ("Grids inside Shadow DOM" in the API reference).

With large page text, cell contents are cut off / sizes differ from the headers

Text in cells, the top and bottom bars and popups inherits the page's font-size / line-height / font-family. Column headers, menu items and the like are set in px, and the row height comes from rowHeight, so with large page text the cell contents get cut off. If you don't want the page's settings to carry over, set them on the grid.

.ssg-root {
  font-size: 13px;
  line-height: normal;
}

Tailwind classes passed to classNames don't change the default look

style.css is unlayered CSS, so it always wins over Tailwind v4 utilities inside @layer. Use style.layer.css with a layer order declared before Tailwind, or add ! as in !rounded-none (Loading CSS and coexistence).

Editing and data

Edited values don't stick

The grid doesn't rewrite rows itself. The result of an edit comes back as a new array through onRowsChange; pass it back to rows.

const [rows, setRows] = useState(initialRows);
<SpreadsheetGrid rows={rows} onRowsChange={setRows} columns={columns} />

When editing doesn't start, check the grid's readOnly, the column's editable: false, and canEditCell.

The undo (Ctrl/Cmd+Z) history disappears

When you replace rows from outside the grid, the grid doesn't know about the change and clears the history. The same happens when you rebuild the array received in onRowsChange with map and the like before passing it back (pass back the received array as is). To change rows from a button outside the grid and keep that undoable too, pass it through the handle's applyRows(next) (Selection and clipboard). For tables that change from outside all the time, like stock prices, applyRows(next, { undoable: false }) keeps outside updates out of the history without clearing the current history (since 1.1.0; "Tables that change from outside all the time" in Cell editing). Undo isn't available with serverSide (dataSource).

Line breaks disappear

The default single-line input drops line breaks (a browser behavior), so editing and committing a value with line breaks removes them. Use editor: { type: 'text', multiline: true } for that column. Only autoHeight columns display line breaks as they are (Cell editing).

Pasted values don't go in / "¥12,000" isn't read as a number

Paste skips cells that can't be edited and cells in validationMode: 'reject' columns whose value fails validation. Skipped cells are reported through onPasteSkipped, so let users know, for example with a toast showing the count (since 1.1.0).

Excel currency formats such as "¥12,000", "12,000円" and "(1,200)" can't be read as numbers by the default parser of number columns. Pass numberParser({ strip: ['¥', '円'], negativeParentheses: true }) to the column's parseClipboardValue to strip the symbols and read them as numbers (since 1.1.0; Selection and clipboard).

Searching by display name finds nothing / group headings show codes

In columns whose values are codes and whose screen shows valueFormatter display names, the top bar search and group row headings use the values (codes) by default. To search by display name too, use globalFilterMatch="both"; to show display names in group headings, the column's groupLabel: 'formatted'; to copy and paste display names, the select editor's clipboard: 'label' (all since 1.1.0; Values and labels).

Pasting one cell's value doesn't fill the selected range

Paste writes only the size that was copied. To fill a range with the same value or a series, use the fill handle.

selectCell / startEditing picks the wrong row

Positions are view positions after sorting and filtering, and column positions count the columns the grid adds (such as the row drag handle column). Look them up with getViewRowIndex(rowKey) / getColIndex(columnKey), not rows.findIndex.

getInvalidCells() returns an empty array

With serverSide (dataSource), the grid doesn't hold all rows, so it's empty (with a warning in development). Validate on the server and reject updateRows when a value fails (Validation).

TypeScript

Type errors in a component wrapping the grid (TS2322)

The grid component's type parameter is T extends object (rows are objects). SpreadsheetGridProps<T> has no constraint, so writing the wrapper as plain <T> gives "T is not assignable to object". Write the wrapper with <T extends object> too.

import { SpreadsheetGrid, type SpreadsheetGridProps } from '@ishibashi0112/spreadsheet-grid';

export function CompactGrid<T extends object>(props: SpreadsheetGridProps<T>) {
  return <SpreadsheetGrid rowHeight={32} {...props} />;
}

Adding the same constraint to SpreadsheetGridProps<T> is a candidate for the next major (2.0). If you write <T extends object>, you won't need to change anything then.

React and Next.js

React onlyIssues specific to the Solid version are in Solid notes.

ref stays null (React 18)

When you pass ref directly to the grid, you don't need forwardRef in either React 18.3 or 19. When you wrap the grid in your own component and pass ref to that component, make the wrapper forwardRef in React 18 (the types pass, but React 18 doesn't pass ref as a prop).

Opening the page on Next.js gives 500 / the build stops

You are passing something containing functions (column definitions with valueFormatter and the like, localeTextEn, a grid made with /lite) as props from a server component. Create or import it inside a 'use client' file (Next.js and SSR).

Columns don't show before hydration

The server render is a skeleton with only row numbers and pinned columns. Unpinned columns are drawn after hydration ("What the server render shows" in Next.js and SSR).

Tests and development warnings

Rows aren't drawn in jsdom tests

jsdom doesn't compute layout, so the grid's visible size is 0 and no rows or columns are drawn. Call installJsdomLayoutStubs() from @ishibashi0112/spreadsheet-grid/testing. Only the rows and columns that fit in the stubbed size are drawn (Testing).

Warnings appear in the console in development

The grid warns about mistakes and combinations that don't work, in development only (two lines, one Japanese and one English; nothing in production builds). Examples: a feature missing from /lite (the warning names the part to add in the form filtering: filteringFeature), a typo in a column key of columnHints, or applyState containing conditions for columns not in the current columns. Fix things as the warning says.

I want an English UI

The grid's default texts are Japanese. Pass localeTextEn from @ishibashi0112/spreadsheet-grid/locales/en to localeText (English and text).

Known limitations

What the current version can't do.

  • Row grouping (rowGroup) is clientSide only; serverSide ignores it. It can't be combined with label rows (labelRow) (label rows aren't shown while grouping).
  • With serverSide, undo / redo, adding rows and columns for pasted data that spills over, and row drag aren't available. To add or delete rows, apply the change on the server and reload with refreshServerSide() ("Constraints" in Server-side row model).
  • Row drag isn't available while sorting, filtering or grouping rows (the screen order wouldn't match the order of rows).
  • Multi-select (the select's multiple) doesn't support allowFreeText for text not in the options, fillRow, a limit on how many can be chosen, or row grouping by value (1.11.0; "What this version doesn't support" in Multi-select).
  • The context menu of row numbers can't be opened from the keyboard (the cell menu opens with Shift+F10 / the Menu key on the active cell; Accessibility).
  • Row move animation (animateRows) stops automatically for autoHeight rows and serverSide.
  • Size: clientSide handles up to about 1 million rows. When rows × row height exceeds 15,000,000px (8,000,000px in Firefox), the scroll position is scaled down to fit the browser's limit on element height. Sorting all rows and CSV export aren't time-sliced, so 1 million rows means some waiting (Large data).
  • Server rendering is only the table's skeleton; without JavaScript, the table's contents don't show.
  • iframes: drawing the grid on a page inside an iframe is fine. Drawing from a parent page into the document of a same-origin iframe (as react-frame-component does) isn't supported (the grid listens for presses and keys on the window of the script that drew it, so column width drag, the fill handle, tooltips, ↑↓ in menus and Escape don't work).
  • Supported browsers are Chrome / Edge 111+, Firefox 121+ and Safari 16.4+. In Firefox, the browser's vertical scrollbar remains even with the custom vertical scrollbar (scrollHint).

On this page