ReactTableDefaults not applying
Closed this issue · 2 comments
Gibbo3771 commented
Creating overrides for the column
const columnDefaults = {
...ReactTableDefaults.column,
headerClassName:
"table__header table__header--word-wrap table__header--default",
Cell: props => {
const classes = {
"text-center": true,
"text-center": true
};
if (props.value === undefined) return null;
return typeof props.value === "boolean" ? (
<div className={mapClasses(classes)}>
<CellBoolean value={props.value} />
</div>
) : (
<div className="text--center">{props.value}</div>
);
}
};
Rendering the table:
return (
<FixedColumnTable
className="-striped"
style={{ border: "none", fontSize: "0.75em" }}
data={data}
columns={columns}
column={columnDefaults}
showPagination={false}
defaultPageSize={23}
sortable={false}
/>
);
Basically the column
prop appears to not be doing anything, I tried it by passing the style directly like so:
{
Header: "eWeigh",
accessor: "eweigh",
headerClassName: "table__header--lighter font--bold"
},
This works correctly ^. So it seems trying to overwrite globally is the problem.
Am I missing something or is this a bug?
GuillaumeJasmin commented
Hi,
Thanks for your feedback !
Yes it's a bug, I only use the current column.headerClassName
:
I need to change with this:
headerClassName: cx(
column.headerClassName,
this.props.column && this.props.column.headerClassName,
...
)
GuillaumeJasmin commented
fixed on v2.1.2