Table: add disabled state to multiple selection header checkbox (#9543)

pull/9549/head
杨奕 2018-01-30 12:02:20 +08:00 committed by GitHub
parent ca02cb9cd3
commit ba284c72d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,7 @@ const forced = {
selection: {
renderHeader: function(h, { store }) {
return <el-checkbox
disabled={ store.states.data && store.states.data.length === 0 }
indeterminate={ store.states.selection.length > 0 && !this.isAllSelected }
nativeOn-click={ this.toggleAllSelection }
value={ this.isAllSelected } />;

View File

@ -298,6 +298,7 @@ TableStore.prototype.mutations = {
toggleAllSelection: debounce(10, function(states) {
const data = states.data || [];
if (data.length === 0) return;
const value = !states.isAllSelected;
const selection = this.states.selection;
let selectionChanged = false;