The New Way to Build with AI! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Browse ReUI Pro

Column Pinning on DataGrid not pinning to side when scrolling horizontally


hey guys, so im using datagrids and trying to work on the datagrid column pinning functionality, now ive followed the reui docs for the example of using datagrids

now in my implementation when i pin it to the left or right it works but when i scroll horizontally it doesnt stay pinned to the screen on the side

https://github.com/moahnaf11/MCA-Metronic/blob/main/src/pages/archived/archived.tsx

heres the file for the code lines 731 is the datagrid component


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)

Hi Mohammad,

Understanding

You're using the ReUI DataGrid with column pinning. When you pin columns to the left or right, the pinning works initially but the columns don't stay in place when you scroll horizontally.

Solution

This is a common issue with ReUI's DataGrid column pinning. The pinned columns use CSS position: sticky, which requires the table container to have overflow-x set to auto or scroll for the sticky behaviour to work.

Here's what to check:

  1. Make sure the DataGrid is inside the ReUI DataGridTableViewport — the wrapper component that handles the scrollable viewport with proper overflow. If you wrapped the DataGrid in your own container, the overflow might not be set correctly.

  2. Check for parent overflow: hidden — if any ancestor of the DataGrid has overflow: hidden, sticky positioning on the columns won't work outside that container. Remove or change overflow: hidden on parent divs.

  3. The DataGrid needs a defined width — if the grid is inside a flex container without a fixed width, the table may not have enough room to scroll, and sticky won't engage.

  4. Verify you're passing columnPinning state correctly — In TanStack Table v9 (used by ReUI), pinning uses start/end (not left/right). Your pin state should look like:

    columnPinning: {
      start: ['columnId1', 'columnId2'],
      end: ['columnId3']
    }
    

Could you share a minimal reproduction of your DataGrid setup? That would help narrow down exactly where the sticky positioning is being blocked.

Sources

Next Steps

If the above doesn't resolve it, try isolating the DataGrid in a simple page with no custom containers to confirm the pinning works in a clean setup.


This reply was generated by AI. A human will follow up if needed.

 
Deleted comment
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
buy metronic keenthemes mega bundle

ReUI

Open-source React components, blocks and templates built on shadcn/ui and Tailwind CSS by Keenthemes.