【发布时间】:2020-09-23 19:16:26
【问题描述】:
我正在使用 React-Bootstrap-Table-2 开发表格显示等 所以今天我已经成功地将表格添加到我的代码中,现在我想在表格标题的顶部添加排序和搜索功能这两个功能
我的代码如下:
render() {
const colStyle = {
backgroundColor: '#6c757d',
color: '#ffffff',
width: '100px'
}
// *what should I add here for search and sorting?
const columns = [{
dataField: 'ProductID',
text: 'ProductID',
headerStyle: colStyle
}, {
dataField: 'ProductName',
text: 'ProductName',
headerStyle: colStyle
}, {
dataField: 'ProductPrice',
text: 'ProductPrice',
headerStyle: colStyle
}];
const {
filter,data
} = this.state;
我尝试通过以下方式解决我的专栏问题:
const columns = [{
dataField: 'ProductID',
text: 'ProductID',
sort: true
headerStyle: colStyle
},
添加sort: true,至少它是可点击的,但它似乎没有任何排序操作
至于搜索功能,如果我添加到上面的代码位置是否正确?
【问题讨论】:
标签: reactjs react-bootstrap react-bootstrap-table