Skip to content

Commit

Permalink
fix insert row duplicated bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Dec 6, 2015
1 parent 8be7725 commit a47276a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/store/TableDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ export class TableDataStore {
}

add(newObj) {
if (newObj[this.keyField].trim() === "") {
if (!newObj[this.keyField] || newObj[this.keyField].toString() === '') {
throw this.keyField + " can't be empty value.";
}
let currentDisplayData = this.getCurrentDisplayData();
currentDisplayData.forEach(function (row) {
if (row[this.keyField].toString() === newObj[this.keyField]) {
if (row[this.keyField].toString() === newObj[this.keyField].toString()) {
throw this.keyField + " " + newObj[this.keyField] + " already exists";
}
}, this);
Expand Down

0 comments on commit a47276a

Please sign in to comment.