Commit d854c883 authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

add functions for clear option

parent 5a0f3f84
......@@ -568,6 +568,11 @@ var editor;
return ws.clearFilter();
};
spreadsheet_api.prototype.asc_clearFilterColumn = function(cellId, displayName) {
var ws = this.wb.getWorksheet();
return ws.clearFilterColumn(cellId, displayName);
};
spreadsheet_api.prototype.asc_changeSelectionFormatTable = function(tableName, optionType) {
var ws = this.wb.getWorksheet();
return ws.af_changeSelectionFormatTable(tableName, optionType);
......
......@@ -2414,6 +2414,39 @@
}
return res;
},
_getColIdColumn: function(filter, cellId)
{
var res = null;
var autoFilter = filter && filter.getType() === g_nFiltersType.tablePart ? filter.AutoFilter : filter;
if(autoFilter && autoFilter.FilterColumns && autoFilter.FilterColumns.length)
{
var rangeCellId = this._idToRange(cellId);
var colId = autoFilter.Ref.c2 - rangeCellId.c1;
res = this._getTrueColId(filter, colId);
}
return res;
},
_getIndexByColId: function(autoFilter, cellId)
{
var res = null;
for(var i = 0; i < autoFilter.FilterColumns.length; i++)
{
if(autoFilter.FilterColumns[i].ColId === colId)
{
index = i;
break;
}
}
return res;
},
_hiddenAnotherFilter: function(filterColumns, cellId, r, c)
......@@ -4291,6 +4324,24 @@
return oldFilter.Ref;
},
clearFilterColumn: function(cellId, displayName)
{
var filter = this._getFilterByDisplayName(displayName);
var autoFilter = filter && filter.getType() === g_nFiltersType.tablePart ? filter.AutoFilter : filter;
var colId = this._getColIdColumn(filter, cellId);
if(colId !== null)
{
var index = this._getIndexByColId(filter, colId);
this._openHiddenRowsAfterDeleteColumn(autoFilter, colId);
autoFilter.FilterColumns.splice(index, 1);
}
return filter.Ref;
},
_checkValueInCells: function(n, k, cloneActiveRange)
{
......
......@@ -12063,6 +12063,22 @@
};
this._isLockedAll( onChangeAutoFilterCallback );
};
WorksheetView.prototype.clearFilterColumn = function (cellId, displayName) {
var t = this;
var onChangeAutoFilterCallback = function ( isSuccess ) {
if ( false === isSuccess ) {
return;
}
var updateRange = t.model.autoFilters.clearFilterColumn( cellId, displayName );
if(false !== updateRange)
t._onUpdateFormatTable(updateRange, false, true);
};
this._isLockedAll( onChangeAutoFilterCallback );
};
/**
* Обновление при изменениях форматированной таблицы
......
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