Commit 527ecb37 authored by GoshaZotov's avatar GoshaZotov

fix bug 34146

parent fd4a0bcd
...@@ -5403,7 +5403,7 @@ TablePart.prototype.moveRef = function(col, row) { ...@@ -5403,7 +5403,7 @@ TablePart.prototype.moveRef = function(col, row) {
this.SortState.moveRef(col, row); this.SortState.moveRef(col, row);
} }
}; };
TablePart.prototype.changeRef = function(col, row, bIsFirst) { TablePart.prototype.changeRef = function(col, row, bIsFirst, bIsNotChangeAutoFilter) {
var ref = this.Ref.clone(); var ref = this.Ref.clone();
if(bIsFirst) if(bIsFirst)
ref.setOffsetFirst({offsetCol: col ? col : 0, offsetRow: row ? row : 0}); ref.setOffsetFirst({offsetCol: col ? col : 0, offsetRow: row ? row : 0});
...@@ -5415,7 +5415,7 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) { ...@@ -5415,7 +5415,7 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
//event //event
this.handlers.trigger("changeRefTablePart", this); this.handlers.trigger("changeRefTablePart", this);
if(this.AutoFilter) if(this.AutoFilter && !bIsNotChangeAutoFilter)
{ {
this.AutoFilter.changeRef(col, row, bIsFirst); this.AutoFilter.changeRef(col, row, bIsFirst);
} }
...@@ -5783,6 +5783,20 @@ TablePart.prototype.changeAltTextSummary = function(val) ...@@ -5783,6 +5783,20 @@ TablePart.prototype.changeAltTextSummary = function(val)
this.altTextSummary = val; this.altTextSummary = val;
}; };
TablePart.prototype.addAutoFilter = function()
{
var autoFilter = new AscCommonExcel.AutoFilter();
var cloneRef = this.Ref.clone();
if(this.TotalsRowCount)
{
cloneRef.r2--
}
autoFilter.Ref = cloneRef;
this.AutoFilter = autoFilter;
return autoFilter;
};
/** @constructor */ /** @constructor */
function AutoFilter() { function AutoFilter() {
......
...@@ -417,8 +417,7 @@ ...@@ -417,8 +417,7 @@
if(tablePartsContainsRange) if(tablePartsContainsRange)
{ {
cloneFilter = tablePartsContainsRange.clone(null); cloneFilter = tablePartsContainsRange.clone(null);
tablePartsContainsRange.AutoFilter = new AscCommonExcel.AutoFilter(); tablePartsContainsRange.addAutoFilter();
tablePartsContainsRange.AutoFilter.Ref = tablePartsContainsRange.Ref.clone();
//history //history
t._addHistoryObj(cloneFilter, AscCH.historyitem_AutoFilter_Add, t._addHistoryObj(cloneFilter, AscCH.historyitem_AutoFilter_Add,
...@@ -631,10 +630,7 @@ ...@@ -631,10 +630,7 @@
autoFilter = filterObj.filter.AutoFilter; autoFilter = filterObj.filter.AutoFilter;
if(!autoFilter) if(!autoFilter)
{ {
autoFilter = new AscCommonExcel.AutoFilter(); autoFilter = filterObj.filter.addAutoFilter();
autoFilter.Ref = currentFilter.Ref.clone();
filterObj.filter.AutoFilter = autoFilter;
} }
var newFilterColumn; var newFilterColumn;
...@@ -685,9 +681,12 @@ ...@@ -685,9 +681,12 @@
var startRow = autoFilter && autoFilter.Ref ? autoFilter.Ref.r1 + 1 : currentFilter.Ref.r1 + 1; var startRow = autoFilter && autoFilter.Ref ? autoFilter.Ref.r1 + 1 : currentFilter.Ref.r1 + 1;
var endRow = autoFilter && autoFilter.Ref ? autoFilter.Ref.r2 : currentFilter.Ref.r2; var endRow = autoFilter && autoFilter.Ref ? autoFilter.Ref.r2 : currentFilter.Ref.r2;
if(currentFilter && !currentFilter.isAutoFilter() && currentFilter.TotalsRowCount) if(currentFilter && !currentFilter.isAutoFilter() && currentFilter.TotalsRowCount)
{
if(currentFilter.Ref.isEqual(autoFilter.Ref))
{ {
endRow--; endRow--;
} }
}
var hiddenObj = {start: currentFilter.Ref.r1 + 1, h: null}; var hiddenObj = {start: currentFilter.Ref.r1 + 1, h: null};
var nHiddenRowCount = 0; var nHiddenRowCount = 0;
...@@ -2516,7 +2515,7 @@ ...@@ -2516,7 +2515,7 @@
this._clearRange(clearRange, true); this._clearRange(clearRange, true);
tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null; tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null;
tablePart.changeRef(null, -1); tablePart.changeRef(null, -1, null, true);
} }
else else
{ {
...@@ -2528,7 +2527,7 @@ ...@@ -2528,7 +2527,7 @@
isSetType = true; isSetType = true;
tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null; tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null;
tablePart.changeRef(null, 1); tablePart.changeRef(null, 1, null, true);
} }
else else
{ {
...@@ -2538,7 +2537,7 @@ ...@@ -2538,7 +2537,7 @@
isSetType = true; isSetType = true;
tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null; tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null;
tablePart.changeRef(null, 1); tablePart.changeRef(null, 1, null, true);
} }
if(val === true) if(val === true)
...@@ -2589,8 +2588,7 @@ ...@@ -2589,8 +2588,7 @@
if(null === tablePart.AutoFilter) if(null === tablePart.AutoFilter)
{ {
tablePart.AutoFilter = new AscCommonExcel.AutoFilter(); tablePart.addAutoFilter();
tablePart.AutoFilter.Ref = tablePart.Ref.clone();
} }
} }
...@@ -3659,8 +3657,7 @@ ...@@ -3659,8 +3657,7 @@
if(!bWithoutFilter) if(!bWithoutFilter)
{ {
newFilter.AutoFilter = new AscCommonExcel.AutoFilter(); newFilter.addAutoFilter();
newFilter.AutoFilter.Ref = ref;
} }
newFilter.TableStyleInfo = new AscCommonExcel.TableStyleInfo(); newFilter.TableStyleInfo = new AscCommonExcel.TableStyleInfo();
......
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