Commit 7399ee22 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

рефакторинг

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56015 954022d7-b5bf-4e40-9824-e11837661b57
parent 8b8d43cc
...@@ -3655,14 +3655,10 @@ var gUndoInsDelCellsFlag = true; ...@@ -3655,14 +3655,10 @@ var gUndoInsDelCellsFlag = true;
} }
}, },
_getArrayOpenCells : function(index,buttonId) _getArrayOpenCells : function(index, buttonId)
{ {
var ws = this.worksheet; var aWs = this._getCurrentWS(), currentFilter, numFilter, curIndex = index.split(':'), opFil;
var aWs = this._getCurrentWS();
var currentFilter;
var numFilter;
var curIndex = index.split(':');
var opFil;
if(curIndex[0] == 'all') if(curIndex[0] == 'all')
{ {
currentFilter = aWs.AutoFilter; currentFilter = aWs.AutoFilter;
...@@ -3682,18 +3678,23 @@ var gUndoInsDelCellsFlag = true; ...@@ -3682,18 +3678,23 @@ var gUndoInsDelCellsFlag = true;
if(!currentFilter.AutoFilter.FilterColumns) if(!currentFilter.AutoFilter.FilterColumns)
currentFilter.AutoFilter.FilterColumns = []; currentFilter.AutoFilter.FilterColumns = [];
opFil = currentFilter.AutoFilter.FilterColumns; opFil = currentFilter.AutoFilter.FilterColumns;
} };
//анализируем структуру фильтра //анализируем структуру фильтра
//проверяем какие параметры применены к данному столбцу и к другим в этом фильтре //проверяем какие параметры применены к данному столбцу и к другим в этом фильтре
//проходимся по всем фильтрам //проходимся по всем фильтрам
var idDigitalFilter = false;
var min;
if(opFil) if(opFil)
{ {
var isFilterCol = false; var result = this._getOpenAndClosedValues(numFilter, currentFilter, opFil, buttonId);
var result = []; return result;
};
},
_getOpenAndClosedValues: function(numFilter, currentFilter, opFil, buttonId)
{
var isFilterCol = false, idDigitalFilter = false, result = [], ws = this.worksheet;
for(var fN = 0; fN < opFil.length; fN++) for(var fN = 0; fN < opFil.length; fN++)
{ {
var curFilter = opFil[fN]; var curFilter = opFil[fN];
...@@ -3878,7 +3879,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -3878,7 +3879,7 @@ var gUndoInsDelCellsFlag = true;
var startRow = ws.model.getCell(new CellAddress(acCell.id)).first.row - 1; var startRow = ws.model.getCell(new CellAddress(acCell.id)).first.row - 1;
var endRow = ws.model.getCell(new CellAddress(acCell.idNext)).first.row - 1; var endRow = ws.model.getCell(new CellAddress(acCell.idNext)).first.row - 1;
var col = ws.model.getCell(new CellAddress(acCell.id)).first.col - 1; var col = ws.model.getCell(new CellAddress(acCell.id)).first.col - 1;
for(nRow = startRow + 1; nRow <= endRow; nRow++) for(var nRow = startRow + 1; nRow <= endRow; nRow++)
{ {
var cell = ws.model.getCell(new CellAddress(nRow,col,0)); var cell = ws.model.getCell(new CellAddress(nRow,col,0));
var val = cell.getValueWithFormat(); var val = cell.getValueWithFormat();
...@@ -4018,11 +4019,16 @@ var gUndoInsDelCellsFlag = true; ...@@ -4018,11 +4019,16 @@ var gUndoInsDelCellsFlag = true;
} }
} }
} }
if(!isFilterCol)//если фильтр не применен if(!isFilterCol)//если фильтр не применен
{ {
var ref = currentFilter.Ref; var ref = currentFilter.Ref;
var filterStart = ws.model.getCell(new CellAddress(ref.split(':')[0]));
var filterEnd = ws.model.getCell(new CellAddress(ref.split(':')[1])); var rangeFilter = this._refToRange(ref);
//var filterStart = ws.model.getCell(new CellAddress(ref.split(':')[0]));
//var filterEnd = ws.model.getCell(new CellAddress(ref.split(':')[1]));
//если есть мерженные ячейки в головной строке //если есть мерженные ячейки в головной строке
var cell = ws.model.getCell(new CellAddress(buttonId)); var cell = ws.model.getCell(new CellAddress(buttonId));
var isMerged = cell.hasMerged(); var isMerged = cell.hasMerged();
...@@ -4034,8 +4040,13 @@ var gUndoInsDelCellsFlag = true; ...@@ -4034,8 +4040,13 @@ var gUndoInsDelCellsFlag = true;
} }
var col = ws.model.getCell(new CellAddress(buttonId)).first.col - 1; var col = ws.model.getCell(new CellAddress(buttonId)).first.col - 1;
var startRow = filterStart.first.row;
var endRow = filterEnd.first.row - 1; //var startRow = filterStart.first.row;
//var endRow = filterEnd.first.row - 1;
var startRow = rangeFilter.r1 + 1;
var endRow = rangeFilter.r2;
var nC = 0; var nC = 0;
for(var s = startRow; s <= endRow; s++) for(var s = startRow; s <= endRow; s++)
{ {
...@@ -4059,7 +4070,10 @@ var gUndoInsDelCellsFlag = true; ...@@ -4059,7 +4070,10 @@ var gUndoInsDelCellsFlag = true;
else else
nC++; nC++;
} }
} };
var idDigitalFilter = result.dF;
for(var i = 0; i < result.length; i++) for(var i = 0; i < result.length; i++)
{ {
if(this._findCloneElement2(result,i)) if(this._findCloneElement2(result,i))
...@@ -4067,21 +4081,12 @@ var gUndoInsDelCellsFlag = true; ...@@ -4067,21 +4081,12 @@ var gUndoInsDelCellsFlag = true;
result.splice(i,1); result.splice(i,1);
i--; i--;
} }
} };
if(idDigitalFilter) if(idDigitalFilter)
result.dF = true; result.dF = true;
/*for(var l = 0; l < result.length; )
{
if(result[l].rep)
result.splice(l,1);
else
l++*/
/*if(result[l].rep)
result[l].visible = 'hidden';
delete result[l].rep;*/
//}
return result; return result;
}
}, },
_addNewFilter: function(val,tableColumns,aWs,isAll,style) _addNewFilter: function(val,tableColumns,aWs,isAll,style)
......
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