React-bootstrap-table2: Can't select rows when using setState with an array value

Created on 8 Feb 2019  路  4Comments  路  Source: react-bootstrap-table/react-bootstrap-table2

This issue is very similar to https://github.com/react-bootstrap-table/react-bootstrap-table2/issues/297, which has been fixed (and works!), but if you try to setState with an array, the issue returns.

Partial example:

constructor(props) {
  super(props);
  this.state = { results: [] };
}

select(row) {
  this.setState({
    results: []
  });
}

const selectRow = {
  mode: 'radio',
  clickToSelect: true,
  onSelect: this.select
};

If you change results: [] to results: '', it works fine.

"react-bootstrap-table-next": "2.0.1",
"react-bootstrap-table2-filter": "1.1.2",
"react-bootstrap-table2-paginator": "2.0.1"

EDIT:
This issue title is a bit lacking, since I just discovered that using an object ({}) in the setState also prevents the selection from showing.

bug

All 4 comments

@pineconesundae I will check this out again, thanks, I just test it again and I found that call setState will break the selection process

Okay so, I tried it with different package versions and feature was working smoothly on initial releases but gone broke on 0.1.4(error) and stopped reflecting checkbox changes after patched in 0.1.5 works perfectly in 0.1.3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thevangelist picture thevangelist  路  4Comments

Randore picture Randore  路  3Comments

nskiro picture nskiro  路  4Comments

rsgoss picture rsgoss  路  4Comments

ethannkschneider picture ethannkschneider  路  3Comments