[英]how to remove the header of the table when using react-bootstrap-table-next
I am using react-bootstrap-table-next to generate a table in my web app and I have data in the columns but I dont want the header to appear.我正在使用 react-bootstrap-table-next 在我的 web 应用程序中生成一个表,并且我在列中有数据,但我不希望 header 出现。 As of now its an empty header with no text but I want that header section to be gone if possible.
到目前为止,它是一个空的 header 没有文字,但我希望 header 部分尽可能消失。 As you can see from the image below, that small header space is what I want to be gone.
从下图中可以看出,那个小 header 空间就是我想要的。 I have tried researching online but nothing I have found seems to work.
我曾尝试在网上进行研究,但我发现似乎没有任何效果。 I tried
display: none
as suggested but no luck.我尝试了
display: none
的建议,但没有运气。
The code below is what I am using to generate the table above.下面的代码是我用来生成上表的代码。 Any guidance or pointers I can use to make that header disappear or is that not possible when using this react library.
我可以用来使 header 消失的任何指导或指针,或者在使用这个反应库时是不可能的。
I have never used that library only use bootstrap with sass and then compile the bootstrap to the project.我从未使用过该库,仅使用带有 sass 的引导程序,然后将引导程序编译到项目中。 It looks like the doc says you can add the attribute headerTitle: true, so I guess you can try to set it to false and see if that works.
看起来文档说您可以添加属性 headerTitle: true,所以我想您可以尝试将其设置为 false 并查看是否有效。
But you are right that doesn't work.但你是对的,那是行不通的。 I found this other attribute and it worked for me.
我发现了这个其他属性,它对我有用。 headerAttrs: { hidden: true }
headerAttrs:{隐藏:真}
const columns = [{
dataField: 'id',
text: 'Product ID',
headerAttrs: {
hidden: true
}
}, {
dataField: 'name',
text: 'Product Name',
headerAttrs: {
hidden: true
}
}, {
dataField: 'price',
text: 'Product Price',
headerAttrs: {
hidden: true
}
}]; }];
let me know if it works for you.请让我知道这对你有没有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.