Commit 527ecb37 authored by GoshaZotov's avatar GoshaZotov

fix bug 34146

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