DEV Community

Kaziu
Kaziu

Posted on

Things to watch out for when using multiple ag-Grids on the same page

(I took notes because multiple ag-Grids on a single page didn't work well)

When I was trying to create multiple ag-grid' table on same page by map() function of javascript, data was overwritten by last one.

the solution is to pass gridOptions as different referenced objects.
(I used spread operator)

// react
{
  items.map((item) => (
    <AgGrid
      gridOptions={{...gridOptions}}
      (others....)
    />
  )
}
Enter fullscreen mode Exit fullscreen mode

▼ issue
looks still this bug doesn't fixed (2025/2/13), or it's just specification? 仕様ですかい?
https://github.com/ag-grid/ag-grid/issues/3354

▼ ag-grid
frontend table library
https://www.ag-grid.com/

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay