Skip to content

Commit

Permalink
fix #366
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Mar 28, 2016
1 parent 509ce22 commit 027c0ec
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/store/TableDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,7 @@ export class TableDataStore {

setData(data) {
this.data = data;
if (this.isOnFilter) {
if (this.filterObj !== null) this.filter(this.filterObj);
if (this.searchText !== null) this.search(this.searchText);
}
if (this.sortObj) {
this.sort(this.sortObj.order, this.sortObj.sortField);
}
this._refresh();
}

getSortInfo() {
Expand All @@ -74,6 +68,16 @@ export class TableDataStore {
else return this.data;
}

_refresh() {
if (this.isOnFilter) {
if (this.filterObj !== null) this.filter(this.filterObj);
if (this.searchText !== null) this.search(this.searchText);
}
if (this.sortObj) {
this.sort(this.sortObj.order, this.sortObj.sortField);
}
}

ignoreNonSelected() {
this.showOnlySelected = !this.showOnlySelected;
if (this.showOnlySelected) {
Expand Down Expand Up @@ -141,6 +145,7 @@ export class TableDataStore {
if (this.isOnFilter) {
this.data.unshift(newObj);
}
this._refresh();
}

add(newObj) {
Expand All @@ -158,6 +163,7 @@ export class TableDataStore {
if (this.isOnFilter) {
this.data.push(newObj);
}
this._refresh();
}

remove(rowKey) {
Expand Down

0 comments on commit 027c0ec

Please sign in to comment.