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

обработка аттрибута blank в автофильтрах

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47854 954022d7-b5bf-4e40-9824-e11837661b57
parent 0b85d8b8
...@@ -2072,13 +2072,22 @@ ...@@ -2072,13 +2072,22 @@
{ {
arrVal = currentFilter[isCurFilter].Filters.Values; arrVal = currentFilter[isCurFilter].Filters.Values;
var isConsist = undefined; var isConsist = undefined;
var isBlank;
for(var h = 0; h < arrVal.length; h++) for(var h = 0; h < arrVal.length; h++)
{ {
if(arrVal[h] == valActive) if(arrVal[h] == valActive)
isConsist = h; isConsist = h;
} }
//в массиве Values не должно находиться пустых значений, должен быть выставлен аттрибут Blank
if('' == valActive && array[i] == true && isConsist == undefined)
{
currentFilter[isCurFilter].Filters.Blank = true;
currentFilter[isCurFilter].Filters.Values.splice(h,1);
continue;
}
else if('' == valActive)
currentFilter[isCurFilter].Filters.Blank = null;
if(array[i] == true && isConsist == undefined)//добавляем значение в конец if(array[i] == true && isConsist == undefined)//добавляем значение в конец
arrVal[arrVal.length] = valActive; arrVal[arrVal.length] = valActive;
else if(array[i] == false && isConsist != undefined)//убираем данное значение из массива else if(array[i] == false && isConsist != undefined)//убираем данное значение из массива
...@@ -3035,6 +3044,7 @@ ...@@ -3035,6 +3044,7 @@
//пересматриваем все значения //пересматриваем все значения
var filValue = curFilter.Filters.Values; var filValue = curFilter.Filters.Values;
var dataValues = curFilter.Filters.Dates; var dataValues = curFilter.Filters.Dates;
var isBlank = curFilter.Filters.Blank;
var nC = 0; var nC = 0;
var acCell = currentFilter.result[curFilter.ColId]; var acCell = currentFilter.result[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;
...@@ -3055,7 +3065,23 @@ ...@@ -3055,7 +3065,23 @@
{ {
for(var nVal = 0; nVal < filValue.length; nVal++) for(var nVal = 0; nVal < filValue.length; nVal++)
{ {
if(filValue[nVal] == val2) if(val2 == '' && isBlank == null)
{
result[nC].val = val;
result[nC].val2 = val2;
if(result[nC].visible != 'hidden')
result[nC].visible = false;
}
if(val2 == '' && isBlank == true)
{
result[nC].val = val;
result[nC].val2 = val2;
isInput = true;
if(result[nC].visible != 'hidden')
result[nC].visible = true;
break;
}
else if(filValue[nVal] == val2)
{ {
result[nC].val = val; result[nC].val = val;
result[nC].val2 = val2; result[nC].val2 = val2;
...@@ -3100,7 +3126,7 @@ ...@@ -3100,7 +3126,7 @@
var check = false; var check = false;
for(var nVal = 0; nVal < filValue.length; nVal++) for(var nVal = 0; nVal < filValue.length; nVal++)
{ {
if(filValue[nVal] == val) if((filValue[nVal] == val) || (val == '' && isBlank == true))
{ {
check = true; check = true;
break; break;
...@@ -3499,6 +3525,7 @@ ...@@ -3499,6 +3525,7 @@
else if(filter && filter.Filters) else if(filter && filter.Filters)
{ {
var customFilter = filter.Filters.Values; var customFilter = filter.Filters.Values;
var isBlank = filter.Filters.Blank;
for(var m = startCell.r1 + 1; m <= endCell.r1; m++) 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();
...@@ -3508,6 +3535,8 @@ ...@@ -3508,6 +3535,8 @@
if(val == customFilter[k]) if(val == customFilter[k])
isVis = true; isVis = true;
} }
if(val == '' && isBlank == true)
isVis = true;
if(!isVis) if(!isVis)
result[m] = true; result[m] = true;
} }
...@@ -4918,6 +4947,36 @@ ...@@ -4918,6 +4947,36 @@
return range; return range;
} }
return false; return false;
},
_addBlankValues: function(aWs)
{
if(aWs.AutoFilter)
{
var filterColumns = aWs.AutoFilter.FilterColumns
for(var i = 0; i < filterColumns.length; i++)
{
var filters = filterColumns[i].Filters;
if(filters && filters.Blank == true)
filters.Values[filters.Values.length] = "";
}
}
if(aWs.TableParts)
{
for(var i = 0; i < aWs.TableParts.length; i++)
{
if(aWs.TableParts[i].AutoFilter)
{
var filterColumns = aWs.TableParts[i].AutoFilter.FilterColumns;
for(var j = 0; j < filterColumns.length; j++)
{
var filters = filterColumns[j].Filters;
if(filters && filters.Blank == true)
filters.Values[filters.Values.length] = "";
}
}
}
}
} }
}; };
......
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