AllenFang / AllenFang/react-bootstrap-table

dynamic options for selectFilter keeps changing to selected option.

Đang mở
#2,111 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
2.2k
Fork
761
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I am using remote select filter where i show the options dynamically and in onTableChange i call the API to update data.it works fine but the options keep changing to only selected one.

```
columns = [
{
dataField: 'item',
text: 'Format',
filter: selectFilter({
options: getOptions('flag'),
// defaultValue:2
})
}
]
```

```
const getOptions = (flag) => {
const data = this.state.tableData;
const optionArray = [...new Set( _.map(data, format))];

let options = {};
for(var i = 0; i < optionArray.length; i++){
options[optionArray[i]] = optionArray[i]
}
console.log(options);

return options;
};

```
```
onTableChange = (type, {page, sizePerPage, sortOrder: order, sortField: sort, filters}) => {
let data = this.state.tableData;
if (type === 'filter') {
this.props.flag(filters.formatDesc.filterVal);
this.props.getData();
}
};
```

let say initial value of options was {'A':'item-1','B':'item-2'}. when i select A the props updates and options changes to {'A':'item-1'} but expected should be {'A':'item-1','B':'item-2'} which was original.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.