Skip to content

Commit

Permalink
fix #1164
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Apr 5, 2017
1 parent 94d8e7c commit 3b67e19
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/store/TableDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,21 @@ export class TableDataStore {
}

getRowByKey(keys) {
return keys.map(key => {
const result = this.data.filter(d => d[this.keyField] === key);
if (result.length !== 0) return result[0];
});
// Bad Performance #1164
// return keys.map(key => {
// const result = this.data.filter(d => d[this.keyField] === key);
// if (result.length !== 0) return result[0];
// });
const 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);
}
}
return result;
}

getSelectedRowKeys() {
Expand Down

0 comments on commit 3b67e19

Please sign in to comment.