Replies: 1 comment 1 reply
-
You should be able to just pass in an <MyColumn index={0}>Name</MyColumn> https://codesandbox.io/s/pedantic-chandrasekhar-trc5f2?file=/src/App.js I think you may be overthinking a solution. Let me know if that isn't enough to handle this use case though. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using
react-aria-components
to wrap aTable
component and I want to freeze the first two columns usingposition: sticky
. I am implementing this functionality in my customColumn
component. When freezing the second column, I need to set theleft
property to the width of the first column, so I need to get and save the widths of all the columns.But here's the problem: when I try to get the width of the previous column, I need to know the index of the current column. However, I couldn't find any props related to the column index in my custom
Column
component. I also tried usingTableStateContext
to get thestate
, but the return value ofuseContext(TableStateContext)
in my custom Column component isnull
.I wonder if I am doing something wrong. Is there any way to get the current index in my custom Column component, or should I use a different approach to set the
left
property of the Column?Beta Was this translation helpful? Give feedback.
All reactions