diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js index fbf16ba4a..79ff2745c 100644 --- a/apps/spreadsheeteditor/main/app/controller/DataTab.js +++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js @@ -86,7 +86,8 @@ define([ 'data:tocolumns': this.onTextToColumn, 'data:show': this.onShowClick, 'data:hide': this.onHideClick, - 'data:groupsettings': this.onGroupSettings + 'data:groupsettings': this.onGroupSettings, + 'data:sortcustom': this.onCustomSort }, 'Statusbar': { 'sheet:changed': this.onApiSheetChanged @@ -212,6 +213,21 @@ define([ this.api.asc_changeGroupDetails(false); }, + onCustomSort: function() { + var me = this; + // (new SSE.Views.SortDialog({ + // title: me.textSort, + // closable: true, + // api: me.api, + // handler: function (result) { + // if (result == 'ok') { + // if (me && me.api) { + // } + // } + // } + // })).show(); + }, + onWorksheetLocked: function(index,locked) { if (index == this.api.asc_getActiveWorksheetIndex()) { Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: [this.view.btnGroup, this.view.btnUngroup]}); @@ -225,7 +241,8 @@ define([ this.onWorksheetLocked(currentSheet, this.api.asc_isWorksheetLockedOrDeleted(currentSheet)); }, - textWizard: 'Text to Columns Wizard' + textWizard: 'Text to Columns Wizard', + textSort: 'Sort' }, SSE.Controllers.DataTab || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 031bdf0e9..cd88d2345 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2285,7 +2285,7 @@ define([ } need_disable = this._state.controlsdisabled.filters || (val===null); toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable, - { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate, toolbar.btnInsertTable) }); + { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnInsertTable) }); val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null; if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) { @@ -2315,10 +2315,10 @@ define([ toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]}); this._state.inpivot = !!info.asc_getPivotTableInfo(); - toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsClearAutofilter, toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable)}); + toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsClearAutofilter, toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable)}); need_disable = !this.appConfig.canModifyFilter; - toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], + toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], toolbar.btnInsertTable)}); } @@ -3148,6 +3148,7 @@ define([ me.toolbar.btnsSortUp = datatab.getButtons('sort-up'); me.toolbar.btnsSetAutofilter = datatab.getButtons('set-filter'); me.toolbar.btnsClearAutofilter = datatab.getButtons('clear-filter'); + me.toolbar.btnCustomSort = datatab.getButtons('sort-custom'); var formulatab = me.getApplication().getController('FormulaDialog'); formulatab.setConfig({toolbar: me}); diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 9d812e6b3..cd2ec0e65 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -185,14 +185,17 @@
- - + +
- - + +
+
+ +
diff --git a/apps/spreadsheeteditor/main/app/view/DataTab.js b/apps/spreadsheeteditor/main/app/view/DataTab.js index 1c4fce192..3469726b5 100644 --- a/apps/spreadsheeteditor/main/app/view/DataTab.js +++ b/apps/spreadsheeteditor/main/app/view/DataTab.js @@ -92,6 +92,9 @@ define([ me.fireEvent('data:clearfilter', [Asc.c_oAscSortOptions.Descending]); }); }); + me.btnCustomSort.on('click', function (b, e) { + me.fireEvent('data:sortcustom'); + }); } return { @@ -162,6 +165,16 @@ define([ Common.Utils.injectComponent($host.find('#slot-btn-hide-details'), this.btnHide); this.lockedControls.push(this.btnHide); + this.btnCustomSort = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-to-columns', + caption: this.capBtnTextCustomSort, + disabled: true, + lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter] + }); + Common.Utils.injectComponent($host.find('#slot-btn-custom-sort'), this.btnCustomSort); + this.lockedControls.push(this.btnCustomSort); + this.btnsSortDown = Common.Utils.injectButtons($host.find('.slot-sortdesc'), '', 'btn-sort-down', '', [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter]); @@ -225,6 +238,7 @@ define([ me.btnsClearAutofilter.forEach( function(btn) { btn.updateHint(me.toolbar.txtClearFilter); }); + me.btnCustomSort.updateHint(me.tipCustomSort); setEvents.call(me); }); @@ -240,6 +254,8 @@ define([ return this.btnsSortDown; else if (type == 'sort-up') return this.btnsSortUp; + else if (type == 'sort-custom') + return this.btnCustomSort; else if (type == 'set-filter') return this.btnsSetAutofilter; else if (type == 'clear-filter') @@ -271,7 +287,9 @@ define([ capBtnTextShow: 'Show details', capBtnTextHide: 'Hide details', textBelow: 'Summary rows below detail', - textRightOf: 'Summary columns to right of detail' + textRightOf: 'Summary columns to right of detail', + capBtnTextCustomSort: 'Custom Sort', + tipCustomSort: 'Custom sort' } }()), SSE.Views.DataTab || {})); });