-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: column helper utility, deep accessorKey support #4185
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This PR also adds deep dot-notation accessorKey support. So you can do things like |
@tannerlinsley 👋 curious why dots are replaced with I discovered this in having responsively hidden columns but my column ids weren't working because the accessor strings have dot notation but the column visibility replaces (only the first dot, btw). Thanks! |
So I faced this issue in the I got the Here's my usage filterFn: (row, id, filterValue) => {
return row.getValue(id) // type unknown
.toString()
.includes(filterValue);
}, I can ofcourse cast it to a type but that's not the point. P.S If you're wondering what was I doing wrong in the colHelper.accessor((row) => row.health_timestamp, {
id: 'health_timestamp',
cell: ({row}) => <i>{row.getValue('health_timestamp')}</i>,
header: () => <span>Last Name</span>,
}), I struggled to understand what was the fix lol. // New Code
colHelper.accessor((row) => row.health_timestamp, {
id: 'health_timestamp',
cell: ({getValue}) => <i>{getValue()}</i>, // extracted `getValue` instead of `row`
header: () => <span>Last Name</span>,
}), |
This PR adds a
createColumnHelper
utility that adds an extra level of intellisense and safety to column definitions. While column defs can still be defined as plain old javascript objects, this is the new preferred way of doing it.