Commit c78cf253 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@62531 954022d7-b5bf-4e40-9824-e11837661b57
parent f1639e2d
...@@ -3835,25 +3835,14 @@ var maxIndividualValues = 10000; ...@@ -3835,25 +3835,14 @@ var maxIndividualValues = 10000;
var ref = filter.Ref; var ref = filter.Ref;
var filterColumns = filter.FilterColumns; var filterColumns = filter.FilterColumns;
var aWs = this._getCurrentWS(), temp = {}, isDateTimeFormat, dataValue, values = [];
var aWs = this._getCurrentWS(), result = {}, temp = {}, isDateTimeFormat, dataValue; var currentElemArray = this._getFilterColumnNum(filterColumns, cellId);//номер данного фильтра в массиве фильтров
var currentElemArray = null;//номер данного фильтра в массиве фильтров
if(filterColumns && filterColumns.length)
{
for(var i = 0; i < filterColumns.length; i++)
{
if(cellId === filterColumns[i].ColId)
{
currentElemArray = i;
break;
}
}
}
var addValueToMenuObj = function(tempResult, count) var addValueToMenuObj = function(tempResult, count)
{ {
if(isDateTimeFormat) //TODO ветка для добавления даты(как заделаем разделение год/месяц/число в меню)
if(false/*isDateTimeFormat*/)
{ {
if(!result.dates.year) if(!result.dates.year)
result.dates.year = []; result.dates.year = [];
...@@ -3873,14 +3862,13 @@ var maxIndividualValues = 10000; ...@@ -3873,14 +3862,13 @@ var maxIndividualValues = 10000;
result.dates.year[dataValue.year].month[dataValue.month].day[dataValue.d].val = tempResult; result.dates.year[dataValue.year].month[dataValue.month].day[dataValue.d].val = tempResult;
} }
else else
result.values[count] = tempResult; values[count] = tempResult;
}; };
result.values = [];
result.dates = {};
var individualCount, count; var individualCount, count, tempResult;
if(currentElemArray === null || (filterColumns[currentElemArray] && (filterColumns[currentElemArray].Filters || filterColumns[currentElemArray].Top10)))//all filter var isCustomFilters = currentElemArray && filterColumns[currentElemArray] && filterColumns[currentElemArray].CustomFiltersObj;
if(currentElemArray === null || (filterColumns[currentElemArray] && (filterColumns[currentElemArray].Filters || filterColumns[currentElemArray].Top10) || isCustomFilters))
{ {
individualCount = 0; individualCount = 0;
count = 0; count = 0;
...@@ -3899,108 +3887,57 @@ var maxIndividualValues = 10000; ...@@ -3899,108 +3887,57 @@ var maxIndividualValues = 10000;
//value in current column //value in current column
var cell = aWs.getCell3(i, cellId + ref.c1); var cell = aWs.getCell3(i, cellId + ref.c1);
var currentVal = cell.getValueWithFormat(); var text = cell.getValueWithFormat();
var val = currentVal; var val = cell.getValueWithoutFormat();
dataValue = null;
isDateTimeFormat = cell.getNumFormat().isDateTimeFormat(); isDateTimeFormat = cell.getNumFormat().isDateTimeFormat();
if(isDateTimeFormat) //if(isDateTimeFormat)
{ //dataValue = NumFormat.prototype.parseDate(val);
val = cell.getValueWithoutFormat();
dataValue = NumFormat.prototype.parseDate(val);
}
//check duplicate value //check duplicate value
if(temp.hasOwnProperty(currentVal)) if(temp.hasOwnProperty(text))
continue; continue;
var tempResult = new AutoFiltersOptionsElements();
tempResult.visible = true;
tempResult.val = currentVal;
tempResult.text = val;
temp[currentVal] = 1;
//apply filter by current button //apply filter by current button
if(currentElemArray !== null) if(currentElemArray !== null)
{ {
//filter another button if(!this._hiddenAnotherFilter(filterColumns, cellId, i, ref.c1))//filter another button
if(this._hiddenAnotherFilter(filterColumns, cellId, i, ref.c1))
{
tempResult.visible = null;
}
//filter current button
if(tempResult.visible !== null)
{ {
if(!filterColumns[currentElemArray].Top10 && !filterColumns[currentElemArray].isHideValue(val, isDateTimeFormat)) tempResult = new AutoFiltersOptionsElements();
tempResult.val = val;
tempResult.text = text;
tempResult.isDateFormat = cell.getNumFormat().isDateTimeFormat();
//filter current button
if(!filterColumns[currentElemArray].Top10 && !isCustomFilters && !filterColumns[currentElemArray].isHideValue(val, isDateTimeFormat))
tempResult.visible = true; tempResult.visible = true;
else else
tempResult.visible = false; tempResult.visible = false;
//TODO пока не разделяем фильтр по дате и общий
isDateTimeFormat = false;
addValueToMenuObj(tempResult, count); addValueToMenuObj(tempResult, count);
if(!isDateTimeFormat) temp[text] = 1;
count++; count++;
}
else
{
delete result[count];
delete temp[currentVal];
} }
} }
else else
{ {
//TODO пока не разделяем фильтр по дате и общий tempResult = new AutoFiltersOptionsElements();
isDateTimeFormat = false; tempResult.visible = true;
tempResult.val = val;
tempResult.text = text;
tempResult.isDateFormat = cell.getNumFormat().isDateTimeFormat();
addValueToMenuObj(tempResult, count); addValueToMenuObj(tempResult, count);
temp[text] = 1;
if(!isDateTimeFormat)
count++;
}
individualCount++;
}
}
else if(filterColumns[currentElemArray] && filterColumns[currentElemArray].CustomFiltersObj && filterColumns[currentElemArray].CustomFiltersObj.CustomFilters)//custom filter
{
individualCount = 0;
count = 0;
for(var i = ref.r1 + 1; i <= ref.r2; i++)
{
//max strings
if(individualCount > maxIndividualValues)
break;
//value in current column
var cell = aWs.getCell3(i, cellId + ref.c1);
var currentVal = cell.getValueWithFormat();
//check duplicate value
if(temp.hasOwnProperty(currentVal))
continue;
if(!this._hiddenAnotherFilter(filterColumns, cellId, i, ref.c1))
{
result.values[count] = new AutoFiltersOptionsElements();
result.values[count].visible = false;
result.values[count].val = currentVal;
result.values[count].text = currentVal;
temp[currentVal] = 1;
count++; count++;
} }
individualCount++; individualCount++;
} }
} }
return this._sortArrayMinMax(result.values); return this._sortArrayMinMax(values);
console.timeEnd("new"); console.timeEnd("new");
}, },
...@@ -4770,6 +4707,23 @@ var maxIndividualValues = 10000; ...@@ -4770,6 +4707,23 @@ var maxIndividualValues = 10000;
} }
} }
return filters; return filters;
},
_getFilterColumnNum: function(filterColumns, colId)
{
var currentElemArray = null;
if(filterColumns && filterColumns.length)
{
for(var i = 0; i < filterColumns.length; i++)
{
if(colId === filterColumns[i].ColId)
{
currentElemArray = i;
break;
}
}
}
return currentElemArray;
} }
}; };
......
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