Commit 31082d6c authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

change function applyAutoFilterByType

parent c5d17452
...@@ -12014,41 +12014,25 @@ ...@@ -12014,41 +12014,25 @@
var ar = t.activeRange.clone( true ); var ar = t.activeRange.clone( true );
var isStartRangeIntoFilterOrTable = t.model.autoFilters.isStartRangeContainIntoTableOrFilter(ar); var isStartRangeIntoFilterOrTable = t.model.autoFilters.isStartRangeContainIntoTableOrFilter(ar);
var isApplyAutoFilter = null, iaAddAutoFilter = null, cellId, filterProps; var isApplyAutoFilter = null, iaAddAutoFilter = null, cellId = null;
if(null !== isStartRangeIntoFilterOrTable)//into autofilter or format table if(null !== isStartRangeIntoFilterOrTable)//into autofilter or format table
{ {
if(-1 === isStartRangeIntoFilterOrTable)//autofilter var isFromatTable = !(-1 === isStartRangeIntoFilterOrTable);
{ var filterRef = isFromatTable ? t.model.TableParts[isStartRangeIntoFilterOrTable].Ref : t.model.AutoFilter.Ref;
var autoFilter = t.model.AutoFilter; cellId = t.model.autoFilters._rangeToId(Asc.Range(ar.c1, filterRef.r1, ar.c1, filterRef.r1));
var colId = ar.c1 - autoFilter.Ref.c1;
filterProps = {id: null, colId: colId};
isApplyAutoFilter = true; isApplyAutoFilter = true;
}
else if(t.model.TableParts[isStartRangeIntoFilterOrTable])//format table
{
var formatTable = t.model.TableParts[isStartRangeIntoFilterOrTable];
if(formatTable.AutoFilter)
{
var autoFilter = t.model.AutoFilter;
var colId = ar.c1 - autoFilter.Ref.c1;
filterProps = {id: null, colId: colId};
isApplyAutoFilter = true; if(isFromatTable && !t.model.TableParts[isStartRangeIntoFilterOrTable].AutoFilter)//add autofilter to tablepart
}
else
{ {
iaAddAutoFilter = true;
}
} }
} }
else//without filter else//without filter
{ {
iaAddAutoFilter = true;
} }
var onChangeAutoFilterCallback = function ( isSuccess ) { var onChangeAutoFilterCallback = function ( isSuccess ) {
if ( false === isSuccess ) { if ( false === isSuccess ) {
return; return;
...@@ -12060,11 +12044,28 @@ ...@@ -12060,11 +12044,28 @@
if(null !== isAddAutoFilter) if(null !== isAddAutoFilter)
{ {
t.model.autoFilters.addAutoFilter(null, ar, addFormatTableOptionsObj); t.model.autoFilters.addAutoFilter(null, ar, addFormatTableOptionsObj);
if(null === cellId)
{
cellId = t.model.autoFilters._rangeToId(Asc.Range(ar.startCol, t.model.AutoFilter.Ref.r1, ar.startCol, t.model.AutoFilter.Ref.r1));
}
} }
if(null !== isApplyAutoFilter) if(null !== isApplyAutoFilter)
{ {
var autoFilterObject = t.af_setDialogProp(filterProps, true); autoFilterObject.asc_setCellId(cellId);
if(c_oAscAutoFilterTypes.Filters === autoFilterObject.filter.type)
{
var autoFiltersOptionsElement = new AutoFiltersOptionsElements();
var cell = t.model._getCell( ar.startRow, ar.startCol);
var text = cell.getValueWithFormat();
var val = cell.getValueWithoutFormat();
autoFiltersOptionsElement.visible = true;
autoFiltersOptionsElement.val = val;
autoFiltersOptionsElement.text = text;
autoFiltersOptionsElement.isDateFormat = cell.getNumFormat().isDateTimeFormat();
autoFilterObject.values.push(autoFiltersOptionsElement);
}
var applyFilterProps = t.model.autoFilters.applyAutoFilter( autoFilterObject, ar ); var applyFilterProps = t.model.autoFilters.applyAutoFilter( autoFilterObject, ar );
......
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