Skip to content

Commit

Permalink
fix #466
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed May 28, 2016
1 parent 690eb12 commit a23c290
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class BootstrapTable extends Component {
let result = true;
if (this.props.selectRow.onSelectAll) {
result = this.props.selectRow.onSelectAll(isSelected,
isSelected ? this.store.get() : []);
isSelected ? this.store.get() : this.store.getRowByKey(this.state.selectedRowKeys));
}

if (typeof result == 'undefined' || result !== false) {
Expand Down
7 changes: 7 additions & 0 deletions src/store/TableDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export class TableDataStore {
this.selected = selectedRowKeys;
}

getRowByKey(keys) {
return keys.map(key => {
const result = this.data.filter(d => d[this.keyField] === key);
if (result.length !== 0) return result[0];
});
}

getSelectedRowKeys() {
return this.selected;
}
Expand Down

0 comments on commit a23c290

Please sign in to comment.