Commit 5742f73e authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

обработка мерженных ячеек в заголовках автофильтра(bug #17865)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48575 954022d7-b5bf-4e40-9824-e11837661b57
parent a46b39c0
...@@ -302,6 +302,7 @@ ...@@ -302,6 +302,7 @@
switch(paramsForCallBack) switch(paramsForCallBack)
{ {
case "changeStyle": case "changeStyle":
{
var cloneFilterOld = Asc.clone(filterChange); var cloneFilterOld = Asc.clone(filterChange);
filterChange.TableStyleInfo.Name = lTable; filterChange.TableStyleInfo.Name = lTable;
splitRange = filterChange.Ref.split(':'); splitRange = filterChange.Ref.split(':');
...@@ -321,7 +322,9 @@ ...@@ -321,7 +322,9 @@
History.TurnOn(); History.TurnOn();
return true; return true;
break; break;
}
case 'deleteFilter': case 'deleteFilter':
{
var isReDrawFilter = false; var isReDrawFilter = false;
if(apocal.all) if(apocal.all)
{ {
...@@ -391,7 +394,9 @@ ...@@ -391,7 +394,9 @@
return true; return true;
} }
break; break;
}
case 'changeAllFOnTable': case 'changeAllFOnTable':
{
//удаляем фильтр //удаляем фильтр
newRes = { newRes = {
result: allAutoFilters[apocal.num].result, result: allAutoFilters[apocal.num].result,
...@@ -517,7 +522,9 @@ ...@@ -517,7 +522,9 @@
if(isTurnOffHistory) if(isTurnOffHistory)
History.TurnOn(); History.TurnOn();
return true; return true;
}
case 'changeStyleWithoutFilter': case 'changeStyleWithoutFilter':
{
changesElemHistory = Asc.clone(filterChange); changesElemHistory = Asc.clone(filterChange);
filterChange.TableStyleInfo.Name = lTable; filterChange.TableStyleInfo.Name = lTable;
splitRange = filterChange.Ref.split(':'); splitRange = filterChange.Ref.split(':');
...@@ -535,8 +542,10 @@ ...@@ -535,8 +542,10 @@
if(isTurnOffHistory) if(isTurnOffHistory)
History.TurnOn(); History.TurnOn();
return true; return true;
break; break
}
case 'setStyleTableForAutoFilter': case 'setStyleTableForAutoFilter':
{
changesElemHistory = Asc.clone(allAutoFilters[apocal.num -1]); changesElemHistory = Asc.clone(allAutoFilters[apocal.num -1]);
var ref = allAutoFilters[apocal.num - 1].Ref; var ref = allAutoFilters[apocal.num - 1].Ref;
allAutoFilters[apocal.num - 1].AutoFilter = allAutoFilters[apocal.num - 1].AutoFilter =
...@@ -544,7 +553,9 @@ ...@@ -544,7 +553,9 @@
Ref: allAutoFilters[apocal.num - 1].Ref Ref: allAutoFilters[apocal.num - 1].Ref
}; };
break; break;
}
case 'setStyleTableForAutoFilter1': case 'setStyleTableForAutoFilter1':
{
changesElemHistory = Asc.clone(allAutoFilters[apocal.num]); changesElemHistory = Asc.clone(allAutoFilters[apocal.num]);
var ref = allAutoFilters[apocal.num].Ref; var ref = allAutoFilters[apocal.num].Ref;
allAutoFilters[apocal.num].AutoFilter = allAutoFilters[apocal.num].AutoFilter =
...@@ -552,6 +563,7 @@ ...@@ -552,6 +563,7 @@
Ref: allAutoFilters[apocal.num].Ref Ref: allAutoFilters[apocal.num].Ref
}; };
break; break;
}
} }
if(paramsForCallBack == "setStyleTableForAutoFilter1" || paramsForCallBack == "setStyleTableForAutoFilter") if(paramsForCallBack == "setStyleTableForAutoFilter1" || paramsForCallBack == "setStyleTableForAutoFilter")
{ {
...@@ -583,6 +595,7 @@ ...@@ -583,6 +595,7 @@
switch(paramsForCallBackAdd) switch(paramsForCallBackAdd)
{ {
case "addTableFilterOneCell": case "addTableFilterOneCell":
{
if(!isTurnOffHistory && addNameColumn) if(!isTurnOffHistory && addNameColumn)
rangeShift.addCellsShiftBottom(); rangeShift.addCellsShiftBottom();
if(lTable) if(lTable)
...@@ -616,7 +629,9 @@ ...@@ -616,7 +629,9 @@
if(addNameColumn && !isTurnOffHistory) if(addNameColumn && !isTurnOffHistory)
mainAdjacentCells.r2 = mainAdjacentCells.r2 + 1; mainAdjacentCells.r2 = mainAdjacentCells.r2 + 1;
break; break;
}
case "addTableFilterManyCells": case "addTableFilterManyCells":
{
if(!isTurnOffHistory && addNameColumn) if(!isTurnOffHistory && addNameColumn)
rangeShift.addCellsShiftBottom(); rangeShift.addCellsShiftBottom();
if(lTable) if(lTable)
...@@ -650,6 +665,7 @@ ...@@ -650,6 +665,7 @@
if(addNameColumn && !isTurnOffHistory) if(addNameColumn && !isTurnOffHistory)
activeCells.r2 = activeCells.r2 + 1; activeCells.r2 = activeCells.r2 + 1;
break break
}
} }
if(paramsForCallBackAdd == "addTableFilterOneCell" || paramsForCallBackAdd == "addAutoFilterOneCell") if(paramsForCallBackAdd == "addTableFilterOneCell" || paramsForCallBackAdd == "addAutoFilterOneCell")
{ {
...@@ -767,7 +783,8 @@ ...@@ -767,7 +783,8 @@
if(openFilter == undefined) { if(openFilter == undefined) {
if(isAll) { if(isAll) {
aWs.AutoFilter = {}; if(!aWs.AutoFilter)
aWs.AutoFilter = {};
aWs.AutoFilter.result = result; aWs.AutoFilter.result = result;
aWs.AutoFilter.Ref = result[0].id + ':' + result[result.length -1].idNext; aWs.AutoFilter.Ref = result[0].id + ':' + result[result.length -1].idNext;
} }
...@@ -819,7 +836,8 @@ ...@@ -819,7 +836,8 @@
else else
return false; return false;
}; };
//***andCallBack
//если уже применён общий автофильтр, то отменяем его //если уже применён общий автофильтр, то отменяем его
var isAll = true; var isAll = true;
...@@ -1005,14 +1023,15 @@ ...@@ -1005,14 +1023,15 @@
var cellId = idCell.getID(); var cellId = idCell.getID();
//скрыты ли какие-нибудь строки данной ячейкой, если да, то добавляем их в массив this.hiddenRowsArr //скрыты ли какие-нибудь строки данной ячейкой, если да, то добавляем их в массив this.hiddenRowsArr
//this._addRowsInHiddenArray(cellId,sCell,eCell,ws); //this._addRowsInHiddenArray(cellId,sCell,eCell,ws);
result[n] = { result[n] = {
x: ws.cols[col].left, x: ws.cols[col].left,
y: ws.rows[sCell.first.row - 1].top, y: ws.rows[sCell.first.row - 1].top,
width: ws.cols[col].width, width: ws.cols[col].width,
height: ws.rows[startCol].height, height: ws.rows[startCol].height,
id: cellId, id: cellId,
idNext: idCellNext.getID() idNext: idCellNext.getID(),
showButton: this._isShowButton(aWs.AutoFilter.FilterColumns, col - startCol)
}; };
n++; n++;
} }
...@@ -1278,7 +1297,20 @@ ...@@ -1278,7 +1297,20 @@
filters = currentFilter.FilterColumns; filters = currentFilter.FilterColumns;
for(var k= 0; k < filters.length; k++) for(var k= 0; k < filters.length; k++)
{ {
if(filters[k].ColId == filtersOp[1]) //для мерженных головных ячеек
var colId = filters[k].ColId;
if(filters[k].ShowButton == false)
{
for(var sb = filters[k].ColId; sb < currentFilter.result.length; sb++)
{
if(currentFilter.result[sb].showButton != false)
{
colId = sb;
break;
}
}
}
if(colId == filtersOp[1] && (filters[k].Filters != null || filters[k].CustomFiltersObj != null))
{ {
isSetFilter = true; isSetFilter = true;
filters = filters[k]; filters = filters[k];
...@@ -1899,6 +1931,26 @@ ...@@ -1899,6 +1931,26 @@
var startRange = ws.model.getCell(new CellAddress(startIdCell)); var startRange = ws.model.getCell(new CellAddress(startIdCell));
var endRange = ws.model.getCell(new CellAddress(endIdCell)); var endRange = ws.model.getCell(new CellAddress(endIdCell));
var isMerged = startRange.hasMerged();
var startCell = this._idToRange(startIdCell);
if(isMerged && startCell.c1 != isMerged.c1)
{
var endCell = this._idToRange(endIdCell);
var diff = startCell.c1 - isMerged.c1;
filtersOp[1] = filtersOp[1] - diff;
startCell.c1 = isMerged.c1;
endCell.c1 = isMerged.c1;
startIdCell = this._rangeToId(startCell);
endIdCell = this._rangeToId(endCell);
startRange = ws.model.getCell(new CellAddress(startIdCell));
endRange = ws.model.getCell(new CellAddress(endIdCell));
isMerged = true;
}
else
isMerged = false;
var arrayFil = []; var arrayFil = [];
if(conFilter.filter1 == null && conFilter.filter2 == null) if(conFilter.filter1 == null && conFilter.filter2 == null)
return; return;
...@@ -1917,7 +1969,7 @@ ...@@ -1917,7 +1969,7 @@
} }
var oldFilter = Asc.clone(currentFilter); var oldFilter = Asc.clone(currentFilter);
//**добавляем данные в aWs.AutoFilter или aWs.TableParts** //**добавляем данные в aWs.AutoFilter или aWs.TableParts**
this._addCustomFilters(indexFilter,ws,aWs,conFilter); this._addCustomFilters(filtersOp,ws,aWs,conFilter,isMerged);
this._addHistoryObj(ws, oldFilter, historyitem_AutoFilter_ApplyDF, this._addHistoryObj(ws, oldFilter, historyitem_AutoFilter_ApplyDF,
{activeCells: ar, autoFiltersObject: autoFiltersObject}); {activeCells: ar, autoFiltersObject: autoFiltersObject});
...@@ -1965,7 +2017,8 @@ ...@@ -1965,7 +2017,8 @@
//**получаем нужный фильтр** //**получаем нужный фильтр**
var indexFilter = this._findArrayFromAllFilter3(newAcCells,ws,cellId); var indexFilter = this._findArrayFromAllFilter3(newAcCells,ws,cellId);
var filtersOp = indexFilter.split(':'); var filtersOp = indexFilter.split(':');
var currentFilter; var currentFilter;
var ref; var ref;
var filterObj; var filterObj;
...@@ -1985,18 +2038,40 @@ ...@@ -1985,18 +2038,40 @@
ref = aWs.TableParts[filtersOp[0]].AutoFilter.Ref; ref = aWs.TableParts[filtersOp[0]].AutoFilter.Ref;
filterObj = aWs.TableParts[filtersOp[0]]; filterObj = aWs.TableParts[filtersOp[0]];
} }
var oldFilter = Asc.clone(filterObj); var oldFilter = Asc.clone(filterObj);
var cell = ws.model.getCell( new CellAddress(activeCells.r1, activeCells.c1,0));
var rangeStart = this._idToRange(ref.split(':')[0]);
if(newAcCells.c1 == (rangeStart.c1 + parseInt(filtersOp[1])))
{
var isMerged = cell.hasMerged();
if(isMerged)
{
var newCol = isMerged.c1 - rangeStart.c1;
filtersOp[1] = newCol;
}
}
var isCurFilter; var isCurFilter;
for(var l = 0; l < currentFilter.length; l++) for(var l = 0; l < currentFilter.length; l++)
{ {
if(currentFilter[l].ColId == filtersOp[1]) if(currentFilter[l].ColId == filtersOp[1])
isCurFilter = l; isCurFilter = l;
} }
//**преобразуем массив в другой вид** //**преобразуем массив в другой вид**
var isMerged = false;
if(!isArray) if(!isArray)
{ {
var newArray = []; var newArray = [];
//если имеются мерженные области в заголовке то смещаем activeCells.c и curCellId на начало мерженной области
var isMerged = cell.hasMerged();
if(isMerged && activeCells.c1 != isMerged.c1)
{
activeCells.c1 = isMerged.c1;
}
else
isMerged = false;
for(var m = 0; m < array.length; m++) for(var m = 0; m < array.length; m++)
{ {
var val = ws.model.getCell( new CellAddress(activeCells.r1 + m + 1, activeCells.c1,0)).getCells()[0].getValue(); var val = ws.model.getCell( new CellAddress(activeCells.r1 + m + 1, activeCells.c1,0)).getCells()[0].getValue();
...@@ -2086,13 +2161,22 @@ ...@@ -2086,13 +2161,22 @@
{ {
if(isCurFilter == undefined) if(isCurFilter == undefined)
isCurFilter = currentFilter.length; isCurFilter = currentFilter.length;
currentFilter[isCurFilter] = { if(currentFilter[isCurFilter])
ColId: filtersOp[1], {
Filters:{} currentFilter[isCurFilter].ColId = filtersOp[1];
}; currentFilter[isCurFilter].Filters = {};
}
else
{
currentFilter[isCurFilter] = {
ColId: filtersOp[1],
Filters:{}
};
}
currentFilter[isCurFilter].Filters.Values = []; currentFilter[isCurFilter].Filters.Values = [];
} }
if(isMerged)
currentFilter[isCurFilter].ShowButton = false;
if(cell.getNumFormat().isDateTimeFormat())//получаем данные в формате дата if(cell.getNumFormat().isDateTimeFormat())//получаем данные в формате дата
{ {
if(!currentFilter[isCurFilter].Filters.Dates) if(!currentFilter[isCurFilter].Filters.Dates)
...@@ -2155,7 +2239,21 @@ ...@@ -2155,7 +2239,21 @@
//в случае всех открытых строк - убираем фильтр из aWs //в случае всех открытых строк - убираем фильтр из aWs
if(allVis) if(allVis)
{ {
currentFilter.splice(isCurFilter,1); if(currentFilter[isCurFilter] && currentFilter[isCurFilter].ShowButton == false)
{
currentFilter[isCurFilter].Filters = null;
currentFilter[isCurFilter].CustomFiltersObj = null;
}
else
currentFilter.splice(isCurFilter,1);
/*if(currentFilter[isCurFilter - 1] && currentFilter[isCurFilter - 1].ShowButton == false)
{
for(var l = isCurFilter - 1; l >= 0 ;l--)
{
if(currentFilter[l].ShowButton == false)
currentFilter[l].Filters = null;
}
}*/
isPress = false; isPress = false;
} }
} }
...@@ -2902,10 +3000,15 @@ ...@@ -2902,10 +3000,15 @@
if(!isButtonDraw) if(!isButtonDraw)
{ {
var leng = this.allButtonAF.length; var leng = this.allButtonAF.length;
var n = 0;
for(var i = 0; i < arr.result.length; i++) for(var i = 0; i < arr.result.length; i++)
{ {
this.allButtonAF[leng + i] = arr.result[i]; if(arr.result[i].showButton != false)
this.allButtonAF[leng + i].inFilter = arr.result[0].id + ':' + arr.result[arr.result.length - 1].idNext; {
this.allButtonAF[leng + n] = arr.result[i];
this.allButtonAF[leng + n].inFilter = arr.result[0].id + ':' + arr.result[arr.result.length - 1].idNext;
n++;
}
} }
} }
...@@ -3105,6 +3208,21 @@ ...@@ -3105,6 +3208,21 @@
var isBlank = curFilter.Filters.Blank; var isBlank = curFilter.Filters.Blank;
var nC = 0; var nC = 0;
var acCell = currentFilter.result[curFilter.ColId]; var acCell = currentFilter.result[curFilter.ColId];
//если имеются мерженные ячейки, переносим кнопку
if(acCell.showButton == false)
{
for(var sb = curFilter.ColId + 1; sb < currentFilter.result.length; sb++)
{
if(currentFilter.result[sb].showButton != false)
{
//acCell = currentFilter.result[sb];
break;
}
}
}
if(sb && sb == numFilter)
numFilter = curFilter.ColId;
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;
...@@ -3115,7 +3233,7 @@ ...@@ -3115,7 +3233,7 @@
var val2 = cell.getValueWithoutFormat(); var val2 = cell.getValueWithoutFormat();
if(!result[nC]) if(!result[nC])
result[nC] = new AutoFiltersOptionsElements(); result[nC] = new AutoFiltersOptionsElements();
if(curFilter.ColId == numFilter) if(curFilter.ColId == numFilter)//щёлкнули по кнопке данного фильтра
{ {
var isFilterCol = true; var isFilterCol = true;
var isInput = false; var isInput = false;
...@@ -3157,6 +3275,15 @@ ...@@ -3157,6 +3275,15 @@
} }
} }
} }
else if(filValue && filValue.length == 0 && val2 == '' && isBlank == true)
{
result[nC].val = val;
result[nC].val2 = val2;
isInput = true;
if(result[nC].visible != 'hidden')
result[nC].visible = true;
}
if(dataValues && dataValues.length != 0 && !isInput) if(dataValues && dataValues.length != 0 && !isInput)
{ {
for(var nVal = 0; nVal < dataValues.length; nVal++) for(var nVal = 0; nVal < dataValues.length; nVal++)
...@@ -3179,9 +3306,11 @@ ...@@ -3179,9 +3306,11 @@
} }
} }
} }
else else//тот же диапазон просмотатриваем другими кнопками фильтра
{ {
var check = false; var check = false;
if(filValue.length == 0 && val == '' && isBlank == true)
check = true;
for(var nVal = 0; nVal < filValue.length; nVal++) for(var nVal = 0; nVal < filValue.length; nVal++)
{ {
if((filValue[nVal] == val) || (val == '' && isBlank == true)) if((filValue[nVal] == val) || (val == '' && isBlank == true))
...@@ -3232,6 +3361,20 @@ ...@@ -3232,6 +3361,20 @@
//var filValue = curFilter.Filters.Values; //var filValue = curFilter.Filters.Values;
var nC = 0; var nC = 0;
var acCell = currentFilter.result[curFilter.ColId]; var acCell = currentFilter.result[curFilter.ColId];
//если имеются мерженные ячейки, переносим кнопку
if(acCell.showButton == false)
{
for(var sb = curFilter.ColId + 1; sb < currentFilter.result.length; sb++)
{
if(currentFilter.result[sb].showButton != false)
{
//acCell = currentFilter.result[sb];
break;
}
}
}
if(sb && sb == numFilter)
numFilter = curFilter.ColId;
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;
...@@ -3352,11 +3495,21 @@ ...@@ -3352,11 +3495,21 @@
} }
} }
} }
if(!isFilterCol) if(!isFilterCol)//если фильтр не применен
{ {
var ref = currentFilter.Ref; var ref = currentFilter.Ref;
var filterStart = ws.model.getCell(new CellAddress(ref.split(':')[0])); var filterStart = ws.model.getCell(new CellAddress(ref.split(':')[0]));
var filterEnd = ws.model.getCell(new CellAddress(ref.split(':')[1])); var filterEnd = ws.model.getCell(new CellAddress(ref.split(':')[1]));
//если есть мерженные ячейки в головной строке
var cell = ws.model.getCell(new CellAddress(buttonId));
var isMerged = cell.hasMerged();
if(isMerged)
{
var range = this._idToRange(buttonId);
range.c1 = isMerged.c1;
buttonId = this._rangeToId(range);
}
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 startRow = filterStart.first.row;
var endRow = filterEnd.first.row - 1; var endRow = filterEnd.first.row - 1;
...@@ -3404,7 +3557,29 @@ ...@@ -3404,7 +3557,29 @@
result:val, result:val,
Ref: val[0].id + ':' + val[val.length - 1].idNext Ref: val[0].id + ':' + val[val.length - 1].idNext
}; };
} }
//проходимся по 1 строчке в поиске мерженных областей
var startCol = this._idToRange(val[0].id);
var endCol = this._idToRange(val[val.length - 1].idNext);
var row = startCol.r1;
var cell;
for(var col = startCol.c1; col <= endCol.c1; col++)
{
cell = aWs.getCell( new CellAddress(row, col, 0) );
var isMerged = cell.hasMerged();
if(isMerged && isMerged.c2 != col)
{
if(!aWs.AutoFilter.FilterColumns)
aWs.AutoFilter.FilterColumns = [];
aWs.AutoFilter.FilterColumns[aWs.AutoFilter.FilterColumns.length] =
{
ColId: col - startCol.c1,
ShowButton: false
}
aWs.AutoFilter.result[col - startCol.c1].showButton = false;
}
}
return aWs.AutoFilter; return aWs.AutoFilter;
} }
else else
...@@ -3451,9 +3626,9 @@ ...@@ -3451,9 +3626,9 @@
return cell.getID(); return cell.getID();
}, },
_addCustomFilters: function(index, ws, aWs, valFilter) _addCustomFilters: function(index, ws, aWs, valFilter, isMerged)
{ {
var parIndex = index.split(':'); var parIndex = index;
var curFilter; var curFilter;
if(parIndex[0] == 'all') if(parIndex[0] == 'all')
curFilter = aWs.AutoFilter; curFilter = aWs.AutoFilter;
...@@ -3473,11 +3648,16 @@ ...@@ -3473,11 +3648,16 @@
if(isEn == undefined) if(isEn == undefined)
{ {
curFilter.FilterColumns[curFilter.FilterColumns.length] = this._addNewCustomFilter(valFilter,parIndex[1]) var length = curFilter.FilterColumns.length;
curFilter.FilterColumns[curFilter.FilterColumns.length] = this._addNewCustomFilter(valFilter,parIndex[1]);
if(isMerged)
curFilter.FilterColumns[length].ShowButton = false;
} }
else else
{ {
curFilter.FilterColumns[isEn] = this._addNewCustomFilter(valFilter,parIndex[1]) curFilter.FilterColumns[isEn] = this._addNewCustomFilter(valFilter,parIndex[1])
if(isMerged)
curFilter.FilterColumns[isEn].ShowButton = false;
} }
...@@ -3486,6 +3666,8 @@ ...@@ -3486,6 +3666,8 @@
{ {
curFilter.FilterColumns = []; curFilter.FilterColumns = [];
curFilter.FilterColumns[0] = this._addNewCustomFilter(valFilter,parIndex[1]); curFilter.FilterColumns[0] = this._addNewCustomFilter(valFilter,parIndex[1]);
if(isMerged)
curFilter.FilterColumns[0].ShowButton = false;
} }
}, },
...@@ -3568,6 +3750,17 @@ ...@@ -3568,6 +3750,17 @@
valFilter2: customFilter[1]?customFilter[1].Val : undefined, valFilter2: customFilter[1]?customFilter[1].Val : undefined,
isChecked: filter.CustomFiltersObj.And isChecked: filter.CustomFiltersObj.And
}; };
//для головных мерженных ячеек
if(filter.ShowButton == false)
{
var isMerged = ws.model.getCell( new CellAddress(startCell.r1, startCell.c1, 0)).hasMerged();
if(isMerged)
{
startCell.c1 = isMerged.c1;
}
}
for(var m = startCell.r1 + 1; m <= endCell.r1; m++) for(var m = startCell.r1 + 1; m <= endCell.r1; m++)
{ {
var cell = ws.model.getCell( new CellAddress(m, startCell.c1, 0)).getCells()[0] var cell = ws.model.getCell( new CellAddress(m, startCell.c1, 0)).getCells()[0]
...@@ -3584,11 +3777,17 @@ ...@@ -3584,11 +3777,17 @@
{ {
var customFilter = filter.Filters.Values; var customFilter = filter.Filters.Values;
var isBlank = filter.Filters.Blank; var isBlank = filter.Filters.Blank;
for(var m = startCell.r1 + 1; m <= endCell.r1; m++) //для головных мерженных ячеек
if(filter.ShowButton == false)
{ {
if(!filter.ShowButton) var isMerged = ws.model.getCell( new CellAddress(startCell.r1, startCell.c1, 0)).hasMerged();
if(isMerged)
{ {
startCell.c1 = isMerged.c1;
} }
}
for(var m = startCell.r1 + 1; m <= endCell.r1; m++)
{
var val = ws.model.getCell( new CellAddress(m, startCell.c1, 0)).getCells()[0].getValue(); var val = ws.model.getCell( new CellAddress(m, startCell.c1, 0)).getCells()[0].getValue();
var isVis = false; var isVis = false;
for(var k = 0; k < customFilter.length;k++) for(var k = 0; k < customFilter.length;k++)
...@@ -5046,6 +5245,21 @@ ...@@ -5046,6 +5245,21 @@
} }
} }
} }
},
//ShowButton(в случае объединенных ячеек в автофильтрах)
_isShowButton: function(filterColumns, colId)
{
var result = true;
if(filterColumns && filterColumns.length != 0)
{
for(var i = 0; i < filterColumns.length;i++)
{
if(colId == filterColumns[i].ColId && !filterColumns[i].ShowButton)
result = false;
}
}
return result;
} }
}; };
......
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