react-bootstrap-table icon indicating copy to clipboard operation
react-bootstrap-table copied to clipboard

Customizing table headers

Open riguy724 opened this issue 10 years ago • 10 comments

It appears the combination of a customized header and the 'TextFilter' results in a failed prop type warning. There doesn't seem to be any missing functionality, but just wanted to bring this to light.

bundle.js:9327 Warning: Failed prop type: Invalid prop `columnName` of type `object` supplied to `TextFilter`, expected `string`.
    in TextFilter (created by TableHeaderColumn)
    in TableHeaderColumn (created by Releases)
    in tr (created by TableHeader)
    in thead (created by TableHeader)
<TableHeaderColumn
    ref='theader_release_name'
    key='release_name'
    dataSort={true}
    dataField='release_name'
    width="250px"
    filter={{ type: 'TextFilter', placeholder: 'Release Name' }}
    dataFormat={this.reportLinkCellFormat}>
    <Tooltip label='reltooltip' placement="top" trigger={['hover']} overlay={releaseTooltip}>
        <div>Releases</div>
    </Tooltip>
</TableHeaderColumn>

riguy724 avatar Oct 12 '16 18:10 riguy724

ok, I know the problem probably, because in TableHeaderColumn, I use the this.props.children as a column title and use it anywhere(Include pass children to TextFilter as a columnName prop).

I'll think about how to deal with this issue. Thanks your contribution :) 👍

AllenFang avatar Oct 13 '16 13:10 AllenFang

Just ran into the same issue, not knowing what caused it. This helped us pinpoint it. We were using a span to wrap around the column title for a tooltip. For now we removed that, but it would be nice to have some flexibility around the header.

batjko avatar Nov 22 '16 09:11 batjko

@batjko, ok, I understand. I'll try to improve it. But there's always some restriction, so I can't promise that I can improve this issue. thanks

AllenFang avatar Nov 24 '16 02:11 AllenFang

I have the same problem. I have a filtered column which has a div as header. Thanks

gabrielecorda avatar Mar 07 '17 15:03 gabrielecorda

Running into the same issue, anyone found a workaround?

guntherlaurijssens avatar Aug 01 '17 12:08 guntherlaurijssens

Sorry, I'll fix on v4.0.0 and v4.0.0 will be released in this weekend officially.

AllenFang avatar Aug 05 '17 08:08 AllenFang

Looks like https://github.com/AllenFang/react-bootstrap-table/pull/1534 has been merged, but a fix for this ticket wasn't included. Is it being moved into a post-v4 release?

batjko avatar Aug 06 '17 09:08 batjko

@batjko thanks your remind :)

Actually, it was fixed before, if you have custom header(TableHeaderColumn), now it will work as expected, but please remember to add headerText on TableHeaderColumn !!!

<TableHeaderColumn dataField='xxx' headerText='product'>{ ... }</TableHeaderColumn>

Let me know if there's still any bug when you have customization header, thanks 👍

AllenFang avatar Aug 06 '17 09:08 AllenFang

Hey, i came across this problem today. I have icons in the columns headers and if i set up the filter, it shows this message. If i delete the filter, it doesn't show anymore. Here's the code:

<TableHeaderColumn dataField='selected_option' dataSort dataAlign="center" columnClassName={ this.columnClassNameFormat } filter={{ type: 'TextFilter', delay: 500, placeholder:"Procure"}} width='16%'> Ação

Rclass93 avatar Oct 11 '17 15:10 Rclass93

@Rclass93 As said by @AllenFang don't forget to add headerText on TableHeaderColumn.

<TableHeaderColumn dataField='selected_option' dataSort dataAlign="center" columnClassName={ this.columnClassNameFormat } filter={{ type: 'TextFilter', delay: 500, placeholder:"Procure"}} width='16%' headerText='Acao'> Ação

vikramtrs avatar Oct 19 '17 14:10 vikramtrs