Skip to content

Commit

Permalink
fix #1401
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Jun 24, 2017
1 parent fd63ab9 commit 29064ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,17 +941,17 @@ class BootstrapTable extends Component {
}

deleteRow(dropRowKeys) {
const { onDeleteRow } = this.props.options;
const dropRow = this.store.getRowByKey(dropRowKeys);
const { onDeleteRow, afterDeleteRow } = this.props.options;

if (onDeleteRow) {
onDeleteRow(dropRowKeys);
onDeleteRow(dropRowKeys, dropRow);
}

this.store.setSelectedRowKey([]); // clear selected row key

if (this.allowRemote(Const.REMOTE_DROP_ROW)) {
if (this.props.options.afterDeleteRow) {
this.props.options.afterDeleteRow(dropRowKeys);
}
if (this.allowRemote(Const.REMOTE_DROP_ROW) && afterDeleteRow) {
afterDeleteRow(dropRowKeys, dropRow);
return;
}

Expand Down Expand Up @@ -981,8 +981,8 @@ class BootstrapTable extends Component {
};
});
}
if (this.props.options.afterDeleteRow) {
this.props.options.afterDeleteRow(dropRowKeys);
if (afterDeleteRow) {
afterDeleteRow(dropRowKeys, dropRow);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/store/TableDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ export class TableDataStore {
// if (result.length !== 0) return result[0];
// });
const result = [];
if (!keys || keys.length === 0) {
return result;
}
for (let i = 0; i < this.data.length; i++) {
const d = this.data[i];
if (!keys || keys.length === 0) break;
if (keys.indexOf(d[this.keyField]) > -1) {
keys = keys.filter(k => k !== d[this.keyField]);
result.push(d);
Expand Down

0 comments on commit 29064ff

Please sign in to comment.