diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js
index 596b3df11..c0c2fa909 100644
--- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js
+++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js
@@ -748,10 +748,12 @@ define([
itemTemplate: _.template([
'
',
'
',
'
<%= Common.Utils.String.htmlEncode(value) %>
',
@@ -1035,6 +1037,18 @@ define([
} else {
record.set('check', check);
idxs[parseInt(record.get('throughIndex'))] = check;
+
+ var selectAllState = check;
+ for (var i=0; i< this.cells.length; i++) {
+ var cell = this.cells.at(i);
+ if ('1' == cell.get('groupid') && cell.get('check') !== check) {
+ selectAllState = 'indeterminate';
+ break;
+ }
+ }
+ this.checkCellTrigerBlock = true;
+ this.cells.at(0).set('check', selectAllState);
+ this.checkCellTrigerBlock = undefined;
}
this.btnOk.setDisabled(false);
@@ -1182,7 +1196,8 @@ define([
isnumber, value,
index = 0, throughIndex = 2,
applyfilter = true,
- haveUnselectedCell = false,
+ selectAllState = false,
+ selectedCells = 0,
arr = [], arrEx = [],
idxs = (me.filter) ? me.filteredIndexes : me.throughIndexes;
@@ -1212,9 +1227,7 @@ define([
check : idxs[throughIndex],
throughIndex : throughIndex
}));
- if (!idxs[throughIndex]) {
- haveUnselectedCell = true;
- }
+ if (idxs[throughIndex]) selectedCells++;
} else {
arrEx.push(new Common.UI.DataViewModel({
cellvalue : value
@@ -1224,6 +1237,9 @@ define([
++throughIndex;
});
+ if (selectedCells==arr.length) selectAllState = true;
+ else if (selectedCells>0) selectAllState = 'indeterminate';
+
if (me.filter || idxs[0]==undefined)
idxs[0] = true;
if (!me.filter || arr.length>0)
@@ -1255,7 +1271,7 @@ define([
if (this.cells.length) {
this.checkCellTrigerBlock = true;
- this.cells.at(0).set('check', !haveUnselectedCell);
+ this.cells.at(0).set('check', selectAllState);
this.checkCellTrigerBlock = undefined;
}
this.btnOk.setDisabled(this.cells.length<1);