首页 > 解决方案 > 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. As of now its an empty header with no text but I want that header section to be gone if possible. As you can see from the image below, that small header space is what I want to be gone. I have tried researching online but nothing I have found seems to work. I tried display: none as suggested but no luck.

enter image description here

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.

enter image description here

标签: javascripthtmlcssreactjsreact-table

解决方案


我从来没有使用过那个库,只使用带有 sass 的引导程序,然后将引导程序编译到项目中。看起来文档说您可以添加属性 headerTitle: true,所以我想您可以尝试将其设置为 false 并查看是否有效。

但你是对的,那是行不通的。我发现了这个其他属性,它对我有用。 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
  }

}];

请让我知道这对你有没有用。


推荐阅读