It would be great to have theadClasses and tbodyClasses among the table props.
For example I'd like to apply sticky thead to some tables with css like:
.react-bootstrap-table thead.sticky {
position: sticky;
top: 0;
background-color: #fff;
z-index: 1021;
}
However, I think I can achieve what I want with the wrapperClasses prop.
Anyway, thanks for considering and also thank you for your work!
is this what you're looking for?
https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-column.html
No, I'd like to add some classes to the <thead> ( or <tbody>) elements of the table specifically.
According to these lines:
https://github.com/react-bootstrap-table/react-bootstrap-table2/blob/master/packages/react-bootstrap-table2/src/header.js#L83
https://github.com/react-bootstrap-table/react-bootstrap-table2/blob/master/packages/react-bootstrap-table2/src/body.js#L113
no classnames are applied to these elements.
What's the problem with doing it in your original post, just remove .sticky and put it into a specific css file add that css file to your page?
.react-bootstrap-table thead {
position: sticky;
top: 0;
background-color: #fff;
z-index: 1021;
}
I don't want to apply these css rules to all .react-bootstrap-table tables in my application, only to specific ones. But anyway, as I said above, this is where the wrapperClasses prop is useful. But there might be other uses cases, I'm not sure.
@flc I add a wrapclass for thead and tbody, thanks
@flc https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2020/02/09/version-bump.html
use headerWrapperClasses to add class on thead
use bodyClasses to add class on tbody
Most helpful comment
@flc https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2020/02/09/version-bump.html
use
headerWrapperClassesto add class ontheaduse
bodyClassesto add class ontbody