Commit ba284c72 authored by 杨奕's avatar 杨奕 Committed by GitHub

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

parent ca02cb9c
...@@ -34,6 +34,7 @@ const forced = { ...@@ -34,6 +34,7 @@ const forced = {
selection: { selection: {
renderHeader: function(h, { store }) { renderHeader: function(h, { store }) {
return <el-checkbox return <el-checkbox
disabled={ store.states.data && store.states.data.length === 0 }
indeterminate={ store.states.selection.length > 0 && !this.isAllSelected } indeterminate={ store.states.selection.length > 0 && !this.isAllSelected }
nativeOn-click={ this.toggleAllSelection } nativeOn-click={ this.toggleAllSelection }
value={ this.isAllSelected } />; value={ this.isAllSelected } />;
......
...@@ -298,6 +298,7 @@ TableStore.prototype.mutations = { ...@@ -298,6 +298,7 @@ TableStore.prototype.mutations = {
toggleAllSelection: debounce(10, function(states) { toggleAllSelection: debounce(10, function(states) {
const data = states.data || []; const data = states.data || [];
if (data.length === 0) return;
const value = !states.isAllSelected; const value = !states.isAllSelected;
const selection = this.states.selection; const selection = this.states.selection;
let selectionChanged = false; let selectionChanged = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment