简体   繁体   English

使用 react-bootstrap-table-next 时如何删除表的 header

[英]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.

相关问题 如何控制 react-bootstrap-table-next 中的 boolean 字段 - How to Control boolean field in react-bootstrap-table-next React-Bootstrap-Table-Next 对动态表上的字母数字字符串进行排序 - React-Bootstrap-Table-Next Sort Alphanumeric Strings on Dynamic Table 如何在 react-bootstrap-table-next 表的列中显示倒计时? - How do I display countdowns in a column of a react-bootstrap-table-next table? 从 react-bootstrap-table-next 路由到新组件? - Routing to a new component from react-bootstrap-table-next? React-Bootstrap-Table-Next Search Bar onSearch 不是一个函数 - React-Bootstrap-Table-Next Search Bar onSearch is not a function 复选框在 react-bootstrap-table-next 中不起作用 - check boxes are not functioning in react-bootstrap-table-next 带有 mobx 商店的 react-bootstrap-table-next 不呈现更改 - react-bootstrap-table-next with mobx store doesn't render changes 在React Bootstrap表的标头组中使用过滤器 - Using filters in header group in react bootstrap table 如何将React JS中的普通表转换为使用React Bootstrap表 - How to convert normal table in react js to using react bootstrap table next (已解决)当我在 onSelect 中设置 state 时,useState Hook 不会触发(接下来使用 react-bootstrap-table) - (SOLVED) useState Hook won't trigger when i set state in onSelect (using react-bootstrap-table next)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM