React-bootstrap-table2: classes for thead, tbody?

Created on 16 Jan 2020  路  6Comments  路  Source: react-bootstrap-table/react-bootstrap-table2

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!

Most helpful comment

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bogannathan picture bogannathan  路  4Comments

SandeepKapalawai picture SandeepKapalawai  路  3Comments

imtmh picture imtmh  路  3Comments

epsyan picture epsyan  路  4Comments

ethannkschneider picture ethannkschneider  路  3Comments