简体   繁体   English

react-bootstrap-table2 csv防止导出隐藏列

[英]react-bootstrap-table2 csv prevent export hidden columns

Using react-bootstrap-table2 how would I go about preventing exporting hidden columns in the csv export component? 使用react-bootstrap-table2如何避免在csv导出组件中导出隐藏的列? Currently my UI has the ability to hide columns using the built in column toggle feature in react-bootstrap-table2. 目前,我的UI可以使用react-bootstrap-table2中的内置列切换功能隐藏列。 However, by default csv will export all columns. 但是,默认情况下,csv将导出所有列。

There seems to be a way to do this by row but not seeing anything for by column https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Export%20CSV&selectedStory=Only%20Export%20Filtered%2FSearched%20Rows&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel 似乎有一种方法可以按行执行此操作,但按列https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Export%20CSV&selectedStory=只有%20Export%20Filtered%2FSearched%20Rows&满= 0&插件= 1&故事= 1&panelRight = 0&addonPanel =故事书%2Factions%2Factions面板

According to this part about hiding columns , you can simply add csvExport: false to the column you do not want to export and it will not be exported. 根据关于隐藏列的这一部分 ,您可以简单地将csvExport: false添加到您不想导出的列中,并且不会将其导出。

To do it dynamically, you could add a method that is called when a column is toggled (defined in the ToggleList documentation which will manually set csvExport to true or false on the column that was toggled. 要动态地执行此操作,您可以添加在切换列时调用的方法(在ToggleList文档中定义,该方法将在切换的列上手动将csvExport设置为true或false。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM