Add test ID to data table columns #17086
Unanswered
jacob-carlborg-apoex
asked this question in
Q&A
Replies: 0 comments
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 would like to add a test ID (that is a custom attribute like
data-test="foo"
) to the columns ofv-data-table(-server)
. I want to have this in all my tables. I can use the [item.${string}] slot to do this. So I thought I would create a new component that wraps the data table component. I came up with this:This code snippet adds the
data-test
attribute only to the columns of the regular rows and not to the header row. If I use the same technique to add support for the header columns as well I loose some things, like icon that indicates the sort order.Is there a better way to do this so that I don't loose any functionality or styling? Or is this worth an enhancement request?
Beta Was this translation helpful? Give feedback.
All reactions