Commit 5a0f3f84 authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

add color sort

parent 25832f7f
......@@ -553,9 +553,9 @@ var editor;
ws.applyAutoFilter(autoFilterObject);
};
spreadsheet_api.prototype.asc_sortColFilter = function(type, cellId, displayName) {
spreadsheet_api.prototype.asc_sortColFilter = function(type, cellId, displayName, color) {
var ws = this.wb.getWorksheet();
ws.sortColFilter(type, cellId, displayName);
ws.sortColFilter(type, cellId, displayName, color);
};
spreadsheet_api.prototype.asc_getAddFormatTableOptions = function(range) {
......
......@@ -37,7 +37,9 @@ var c_oAscMergeOptions = {
var c_oAscSortOptions = {
Ascending: 1,
Descending: 2
Descending: 2,
ByColorFill: 3,
ByColorFont: 4
};
var c_oAscBorderOptions = {
......
......@@ -8563,7 +8563,7 @@ Range.prototype.cleanHyperlinks=function(){
this.removeHyperlink(aHyperlinks.inner[i].data);
History.EndTransaction();
};
Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){
Range.prototype.sort=function(nOption, nStartCol, color){
//todo горизонтальная сортировка
var aMerged = this.worksheet.mergeManager.get(this.bbox);
if(aMerged.outer.length > 0 || (aMerged.inner.length > 0 && null == _isSameSizeMerged(this.bbox, aMerged.inner)))
......@@ -8577,7 +8577,10 @@ Range.prototype.sort=function(nOption, nStartCol, colorText, colorFill){
nStartCol = merged.bbox.c1;
}
this.worksheet.workbook.lockDraw();
var isSortColor = !!(colorText || colorFill);
var colorFill = nOption === AscCommonExcel.c_oAscSortOptions.ByColorFill ? color : null;
var colorText = nOption === AscCommonExcel.c_oAscSortOptions.ByColorFont ? color : null;
var isSortColor = !!(colorFill || colorText);
var oRes = null;
var oThis = this;
var bAscent = false;
......
......@@ -1499,7 +1499,7 @@
var t = this;
if(!sortProps)
sortProps = this.getPropForSort(type, cellId, activeRange, displayName);
sortProps = this.getPropForSort(cellId, activeRange, displayName);
curFilter = sortProps.curFilter, sortRange = sortProps.sortRange, filterRef = sortProps.filterRef, startCol = sortProps.startCol, maxFilterRow = sortProps.maxFilterRow;
......@@ -1538,13 +1538,12 @@
onSortAutoFilterCallback();
},
getPropForSort: function(type, cellId, activeRange, displayName)
getPropForSort: function(cellId, activeRange, displayName)
{
var worksheet = this.worksheet;
var t = this;
var curFilter, sortRange, filterRef, startCol, maxFilterRow;
var resType = type == 'ascending';
var isCellIdString = false;
if(cellId !== undefined && cellId != "" && typeof cellId == 'string')
{
......
......@@ -12009,21 +12009,22 @@
this._isLockedAll( onChangeAutoFilterCallback );
};
WorksheetView.prototype.sortColFilter = function ( type, cellId, displayName ) {
WorksheetView.prototype.sortColFilter = function ( type, cellId, displayName, color ) {
var t = this;
var ar = this.activeRange.clone( true );
var onChangeAutoFilterCallback = function ( isSuccess ) {
if ( false === isSuccess ) {
return;
}
var sortProps = t.model.autoFilters.getPropForSort(type, cellId, ar, displayName);
var sortProps = t.model.autoFilters.getPropForSort(cellId, ar, displayName);
var onSortAutoFilterCallBack = function()
{
History.Create_NewPoint();
History.StartTransaction();
t.cellCommentator.sortComments(sortProps.sortRange.sort(type == 'ascending', sortProps.startCol));
var sort = sortProps.sortRange.sort(type, sortProps.startCol, color);
t.cellCommentator.sortComments(sort);
t.model.autoFilters.sortColFilter( type, cellId, ar, sortProps, displayName );
t._onUpdateFormatTable(sortProps.sortRange.bbox, false);
......@@ -12032,7 +12033,7 @@
if(null === sortProps)
{
t.setSelectionInfo("sort", type == 'ascending');
t.setSelectionInfo("sort", type);
}
else if(false !== sortProps)
{
......
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