Merge pull request #4151 from llnewuser/2.0

toggleSelectAll method should only operate on filtered data
This commit is contained in:
Aresn 2018-07-31 10:51:36 +08:00 committed by GitHub
commit 8cc76ed915
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,10 +83,10 @@
return (validKeysCount > 0 ? `${validKeysCount}/` : '') + `${this.data.length}`;
},
checkedAll () {
return this.data.filter(data => !data.disabled).length === this.validKeysCount && this.validKeysCount !== 0;
return this.filterData.filter(data => !data.disabled).length === this.validKeysCount && this.validKeysCount !== 0;
},
checkedAllDisabled () {
return this.data.filter(data => !data.disabled).length <= 0;
return this.filterData.filter(data => !data.disabled).length <= 0;
},
filterData () {
return this.showItems.filter(item => this.filterMethod(item, this.query));
@ -118,8 +118,8 @@
},
toggleSelectAll (status) {
const keys = status ?
this.data.filter(data => !data.disabled || this.checkedKeys.indexOf(data.key) > -1).map(data => data.key) :
this.data.filter(data => data.disabled && this.checkedKeys.indexOf(data.key) > -1).map(data => data.key);
this.filterData.filter(data => !data.disabled || this.checkedKeys.indexOf(data.key) > -1).map(data => data.key) :
this.filterData.filter(data => data.disabled && this.checkedKeys.indexOf(data.key) > -1).map(data => data.key);
this.$emit('on-checked-keys-change', keys);
},
handleQueryClear () {