-
Notifications
You must be signed in to change notification settings - Fork 932
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
Enhancement/custom head render as child #955
Enhancement/custom head render as child #955
Conversation
That property can accept FC or any function whose will be used as child content of `TableHeadCell` component.
Hm, not sure I understand the use of this feature. It was already possible to use icons for headers before with |
But using Please, correct me if i missed something. |
I concur that this is better than customHeadRender. I have something similar in a fork I'm using because customHeadRender requires you too write too much code to replace the header label. Though it might be better to name this function customHeadLabelRender since the content of the header remains the same (the sort arrow, hint, etc), it's just the label that gets overwritten. Using customHeadRender also breaks the resizableColumns feature, so you can't have resizable columns and override a header label. Additionally, using customHeadRender would potentially break future functionality like column dragging to re-order columns. |
Yeah, i agree about property name. |
If I understand correctly, you're just looking to use a custom component for the
|
I will try to add As i see in first look, you found better solution for my problem. I did not inspect source code of your library very well, and i'm not sure how |
I actually still think a render method is better. Using label can lead to other problems, since the label is used in other places like in the TableViewCol component. You don't nescessarily want to render the same thing there as you do in the table header. Some examples:
|
I inspected src code of your library, and i concur @patorjk about separated method. It's because you have dependencies of I added basic support func prop type to column label prop in this PR, but i'm not sure... |
@Lilliance and @patorjk I understand the objections, I'm thinking about it, and whether or not there's some other way to accomplish this goal with a different approach. I know it's inconvenient to work with custom label renders now, but it is possible, and I'm reluctant to keep adding features ad infinitum. Some things are just going to be possible but difficult, as it depends on the priorities of the library. I know it doesn't seem like a big thing to ask, but there's quite a bit of new features coming in which expands the area of the codebase drip by drip, making it difficult to keep everything tested and running smoothly especially if refactoring is needed. But thinking about it. |
Hey @Lilliance, sorry it took a while, but I'm good with this approach. Let's add the option to the documentation and then I think it's good to go! |
I thought about use cases of this PR and noticed one thing.
But it's not documented functionality and we need use Thank you for your help! |
Hey @Lilliance, yes I think for now we're good with |
This feature adding
customHeadLabelRender
propertyThat property can accept FC or any function whose will be used as children
content of
TableHeadCell
component.For example, now you can provide any icon as header:
![Example](https://camo.githubusercontent.com/c2ee6bc60630b4364c8325df78deb67fb593c21a8a73c3456eceafe8c48502cf/68747470733a2f2f692e696d6775722e636f6d2f735834445448742e706e67)
Pros of this feature:
customHeadRender
customHeadRender