diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js index deac676af6..aa58c7dc4a 100644 --- a/apps/spreadsheeteditor/main/app/controller/DataTab.js +++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js @@ -387,19 +387,32 @@ define([ }, showCustomSort: function(expand) { - var me = this, - props = me.api.asc_getSortProps(expand); - // props = new Asc.CSortProperties(); - if (props) { - (new SSE.Views.SortDialog({ - props: props, - api: me.api, - handler: function (result, settings) { - if (me && me.api) { - me.api.asc_setSortProps(settings, result != 'ok'); + if (this.api.asc_getCellInfo().asc_getPivotTableInfo()) { + var info = this.api.asc_getPivotInfo(); + if (info) { + var dlgSort = new SSE.Views.SortFilterDialog({api:this.api}).on({ + 'close': function() { + Common.NotificationCenter.trigger('edit:complete'); } - } - })).show(); + }); + dlgSort.setSettings({filter : info.asc_getFilter(), rowFilter: info.asc_getFilterRow(), colFilter: info.asc_getFilterCol()}); + dlgSort.show(); + } + } else { + var me = this, + props = me.api.asc_getSortProps(expand); + // props = new Asc.CSortProperties(); + if (props) { + (new SSE.Views.SortDialog({ + props: props, + api: me.api, + handler: function (result, settings) { + if (me && me.api) { + me.api.asc_setSortProps(settings, result != 'ok'); + } + } + })).show(); + } } }, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 1bfcd7759b..b988d3cdf8 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -74,7 +74,10 @@ define([ 'spreadsheeteditor/main/app/view/SpecialPasteDialog', 'spreadsheeteditor/main/app/view/SlicerSettingsAdvanced', 'spreadsheeteditor/main/app/view/PivotGroupDialog', - 'spreadsheeteditor/main/app/view/MacroDialog' + 'spreadsheeteditor/main/app/view/MacroDialog', + 'spreadsheeteditor/main/app/view/FieldSettingsDialog', + 'spreadsheeteditor/main/app/view/ValueFieldSettingsDialog', + 'spreadsheeteditor/main/app/view/PivotSettingsAdvanced' ], function () { 'use strict'; @@ -215,6 +218,14 @@ define([ view.mnuRefreshPivot.on('click', _.bind(me.onRefreshPivot, me)); view.mnuGroupPivot.on('click', _.bind(me.onGroupPivot, me)); view.mnuUnGroupPivot.on('click', _.bind(me.onGroupPivot, me)); + view.mnuPivotSettings.on('click', _.bind(me.onPivotSettings, me)); + view.mnuFieldSettings.on('click', _.bind(me.onFieldSettings, me)); + view.mnuDeleteField.on('click', _.bind(me.onDeleteField, me)); + view.mnuSubtotalField.on('click', _.bind(me.onSubtotalField, me)); + view.mnuSummarize.menu.on('item:click', _.bind(me.onSummarize, me)); + view.mnuShowAs.menu.on('item:click', _.bind(me.onShowAs, me)); + view.mnuPivotSort.menu.on('item:click', _.bind(me.onPivotSort, me)); + view.mnuPivotFilter.menu.on('item:click', _.bind(me.onPivotFilter, me)); view.pmiClear.menu.on('item:click', _.bind(me.onClear, me)); view.pmiSelectTable.menu.on('item:click', _.bind(me.onSelectTable, me)); view.pmiInsertTable.menu.on('item:click', _.bind(me.onInsertTable, me)); @@ -267,7 +278,6 @@ define([ view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); view.menuSaveAsPicture.on('click', _.bind(me.saveAsPicture, me)); - if (!me.permissions.isEditMailMerge && !me.permissions.isEditDiagram && !me.permissions.isEditOle) { var oleEditor = me.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); if (oleEditor) { @@ -580,7 +590,7 @@ define([ onRefreshPivot: function(){ if (this.api) { - this.propsPivot.asc_refresh(this.api); + this.propsPivot.originalProps.asc_refresh(this.api); } }, @@ -605,6 +615,275 @@ define([ win.setSettings(rangePr, dateTypes, defRangePr); }, + onPivotSettings: function(){ + var props = this.propsPivot.originalProps; + if (!props) return; + + var me = this; + if (me.api){ + (new SSE.Views.PivotSettingsAdvanced( + { + props: props, + api: me.api, + handler: function(result, value) { + if (result == 'ok' && me.api && value) { + props.asc_set(me.api, value); + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + })).show(); + } + }, + + onFieldSettings: function(){ + var props = this.propsPivot.originalProps; + if (!props) return; + + var me = this; + if (me.api){ + if (me.propsPivot.fieldType === 2) { // value field + var field = me.propsPivot.field; + (new SSE.Views.ValueFieldSettingsDialog( + { + props: props, + field: field, + showAsValue: me.propsPivot.showAsValue, + api: me.api, + handler: function(result, value) { + if (result === 'ok' && me.api && value) { + field.asc_set(me.api, props, me.propsPivot.index, value); + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + })).show(); + } else { + (new SSE.Views.FieldSettingsDialog( + { + props: props, + fieldIndex: me.propsPivot.pivotIndex, + api: me.api, + type: me.propsPivot.fieldType, + handler: function(result, value) { + if (result === 'ok' && me.api && value) { + me.propsPivot.field.asc_set(me.api, props, me.propsPivot.pivotIndex, value); + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + })).show(); + } + } + }, + + onDeleteField: function(){ + if (this.api && this.propsPivot.originalProps && this.propsPivot.field) { + if (this.propsPivot.fieldType===2) { // value + if (this.propsPivot.rowTotal || this.propsPivot.colTotal) { + var props = new Asc.CT_pivotTableDefinition(); + props.asc_setRowGrandTotals(this.propsPivot.rowTotal ? false : this.propsPivot.originalProps.asc_getRowGrandTotals()); + props.asc_setColGrandTotals(this.propsPivot.colTotal ? false : this.propsPivot.originalProps.asc_getColGrandTotals()); + this.propsPivot.originalProps.asc_set(this.api, props); + } else + this.propsPivot.originalProps.asc_removeDataField(this.api, this.propsPivot.pivotIndex, this.propsPivot.index); + } else + this.propsPivot.originalProps.asc_removeNoDataField(this.api, this.propsPivot.pivotIndex); + } + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + }, + + onSubtotalField: function(item){ + if (this.api && this.propsPivot.originalProps) { + var props = new Asc.CT_pivotTableDefinition(); + if (item.checked) { + props.asc_setDefaultSubtotal(true); + props.asc_setSubtotalTop(true); + } else { + props.asc_setDefaultSubtotal(false); + } + this.propsPivot.originalProps.asc_set(this.api, props); + } + }, + + onSummarize: function(menu, item, e) { + if (!this.propsPivot.originalProps) return; + + if (item.value===-1) + this.onFieldSettings(); + else if (item.value!==undefined && item.value!==null) { + var field = new Asc.CT_DataField(); + field.asc_setSubtotal(item.value); + this.propsPivot.field.asc_set(this.api, this.propsPivot.originalProps, this.propsPivot.index, field); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }, + + onShowAs: function(menu, item, e) { + if (!this.propsPivot.originalProps) return; + + if (item.value===-1 || item.options.showMore) { + if (item.options.showMore) + this.propsPivot.showAsValue = item.value; + this.onFieldSettings(); + } else if (item.value!==undefined && item.value!==null) { + var field = new Asc.CT_DataField(); + field.asc_setShowDataAs(item.value); + this.propsPivot.field.asc_set(this.api, this.propsPivot.originalProps, this.propsPivot.index, field); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }, + + showCustomFilterDlg: function(filter, type) { + var filterObj = filter.asc_getFilterObj(); + if (filterObj.asc_getType() !== Asc.c_oAscAutoFilterTypes.CustomFilters) { + var newCustomFilter = new Asc.CustomFilters(); + newCustomFilter.asc_setCustomFilters([new Asc.CustomFilter()]); + + var newCustomFilters = newCustomFilter.asc_getCustomFilters(); + newCustomFilters[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals); + newCustomFilter.asc_setAnd(true); + newCustomFilters[0].asc_setVal(''); + + filterObj.asc_setFilter(newCustomFilter); + filterObj.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters); + } + + var me = this, + dlgDigitalFilter = new SSE.Views.PivotDigitalFilterDialog({api:this.api, type: type}).on({ + 'close': function() { + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + }); + + dlgDigitalFilter.setSettings(filter); + dlgDigitalFilter.show(); + }, + + onPivotFilter: function(menu, item, e) { + if (!this.propsPivot.filter) return; + + var filter = this.propsPivot.filter, + me = this; + if (item.value==='value') { + var pivotObj = filter.asc_getPivotObj(), + fields = pivotObj.asc_getDataFields(); + if (fields.length<2) { + Common.UI.warning({title: this.textWarning, + msg: this.warnFilterError, + callback: function() { + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + }); + } else { + this.showCustomFilterDlg(filter, item.value); + } + } else if (item.value==='label') { + this.showCustomFilterDlg(filter, item.value); + } else if (item.value==='top10') { + var dlgTop10Filter = new SSE.Views.Top10FilterDialog({api:this.api, type: 'value'}).on({ + 'close': function() { + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + }); + dlgTop10Filter.setSettings(filter); + dlgTop10Filter.show(); + } else if (item.value==='clear') { + this.api.asc_clearFilterColumn(filter.asc_getCellId(), filter.asc_getDisplayName()); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }, + + onPivotSort: function(menu, item, e) { + if (!(this.propsPivot.filter || this.propsPivot.rowFilter && this.propsPivot.colFilter)) return; + + var me = this; + if (item.value==='advanced') { + var dlgSort = new SSE.Views.SortFilterDialog({api:this.api}).on({ + 'close': function() { + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + }); + dlgSort.setSettings({filter : this.propsPivot.filter, rowFilter: this.propsPivot.rowFilter, colFilter: this.propsPivot.colFilter}); + dlgSort.show(); + } else { + var filter = this.propsPivot.filter || this.propsPivot.rowFilter; + this.api.asc_sortColFilter(item.value, filter.asc_getCellId(), filter.asc_getDisplayName()); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + } + }, + + fillPivotProps: function() { + var props = this.propsPivot.originalProps; + if (!props) return; + + var info = this.api.asc_getPivotInfo(), + pageFieldIndex = info.asc_getPageFieldIndex(), + colFieldIndex = info.asc_getColFieldIndex(), + rowFieldIndex = info.asc_getRowFieldIndex(), + dataFieldIndex = info.asc_getDataFieldIndex(); + + this.propsPivot.canGroup = info.asc_canGroup(); + this.propsPivot.rowTotal = info.asc_getRowGrandTotals(); + this.propsPivot.colTotal = info.asc_getColGrandTotals(); + this.propsPivot.filter = info.asc_getFilter(); + this.propsPivot.rowFilter = info.asc_getFilterRow(); + this.propsPivot.colFilter = info.asc_getFilterCol(); + + if (colFieldIndex>-1) { + var fprops = props.asc_getColumnFields(); + if (fprops) { + var pivotIndex = fprops[colFieldIndex].asc_getIndex(); + if (pivotIndex>-1) { + this.propsPivot.pivotIndex = pivotIndex; + this.propsPivot.index = colFieldIndex; + this.propsPivot.field = props.asc_getPivotFields()[pivotIndex]; + this.propsPivot.fieldType = 0; + this.propsPivot.fieldName = this.propsPivot.field.asc_getName() || props.asc_getCacheFields()[pivotIndex].asc_getName(); + } + } + } else if (rowFieldIndex>-1) { + var fprops = props.asc_getRowFields(); + if (fprops) { + var pivotIndex = fprops[rowFieldIndex].asc_getIndex(); + if (pivotIndex>-1) { + this.propsPivot.pivotIndex = pivotIndex; + this.propsPivot.index = rowFieldIndex; + this.propsPivot.field = props.asc_getPivotFields()[pivotIndex]; + this.propsPivot.fieldType = 1; + this.propsPivot.fieldName = this.propsPivot.field.asc_getName() || props.asc_getCacheFields()[pivotIndex].asc_getName(); + } + } + } else if (pageFieldIndex>-1) { + var fprops = props.asc_getPageFields(); + if (fprops) { + var pivotIndex = fprops[pageFieldIndex].asc_getIndex(); + if (pivotIndex>-1) { + this.propsPivot.pivotIndex = pivotIndex; + this.propsPivot.index = pageFieldIndex; + this.propsPivot.field = props.asc_getPivotFields()[pivotIndex]; + this.propsPivot.fieldType = 3; + this.propsPivot.fieldName = this.propsPivot.field.asc_getName() || props.asc_getCacheFields()[pivotIndex].asc_getName(); + } + } + } else if (dataFieldIndex>-1) { + var fprops = props.asc_getDataFields(); + if (fprops) { + var pivotIndex = fprops[dataFieldIndex].asc_getIndex(); + if (pivotIndex>-1) { + this.propsPivot.pivotIndex = pivotIndex; + this.propsPivot.index = dataFieldIndex; + this.propsPivot.field = fprops[dataFieldIndex]; + this.propsPivot.fieldType = 2; + this.propsPivot.fieldName = this.propsPivot.field.asc_getName(); + } + } + } + }, + onClear: function(menu, item, e) { if (item.value == Asc.c_oAscCleanOptions.Format && !this._state.wsProps['FormatCells'] || item.value == Asc.c_oAscCleanOptions.All && !this.api.asc_checkLockedCells()) this.onClearCallback(menu, item); @@ -2306,17 +2585,21 @@ define([ seltype !== Asc.c_oAscSelectionType.RangeChart && seltype !== Asc.c_oAscSelectionType.RangeChartText && seltype !== Asc.c_oAscSelectionType.RangeShapeText && seltype !== Asc.c_oAscSelectionType.RangeSlicer)) { if (!documentHolder.ssMenu || !showMenu && !documentHolder.ssMenu.isVisible()) return; - this.propsPivot = cellinfo.asc_getPivotTableInfo(); + this.propsPivot = { + originalProps: cellinfo.asc_getPivotTableInfo() + }; var iscelledit = this.api.isCellEdited, formatTableInfo = cellinfo.asc_getFormatTableInfo(), isinsparkline = (cellinfo.asc_getSparklineInfo()!==null), isintable = (formatTableInfo !== null), ismultiselect = cellinfo.asc_getMultiselect(), - inPivot = !!this.propsPivot; + inPivot = !!this.propsPivot.originalProps; documentHolder.ssMenu.formatTableName = (isintable) ? formatTableInfo.asc_getTableName() : null; documentHolder.ssMenu.cellColor = xfs.asc_getFillColor(); documentHolder.ssMenu.fontColor = xfs.asc_getFontColor(); + documentHolder.pmiCut.setVisible(!inPivot); + documentHolder.pmiPaste.setVisible(!inPivot); documentHolder.pmiInsertEntire.setVisible(isrowmenu||iscolmenu); documentHolder.pmiInsertEntire.setCaption((isrowmenu) ? this.textInsertTop : this.textInsertLeft); documentHolder.pmiDeleteEntire.setVisible(isrowmenu||iscolmenu); @@ -2333,13 +2616,57 @@ define([ documentHolder.pmiFilterCells.setVisible(iscellmenu && !iscelledit && !diagramOrMergeEditor && !inPivot); documentHolder.pmiReapply.setVisible((iscellmenu||isallmenu) && !iscelledit && !diagramOrMergeEditor && !inPivot); documentHolder.pmiCondFormat.setVisible(!iscelledit && !diagramOrMergeEditor); - documentHolder.mnuRefreshPivot.setVisible(iscellmenu && !iscelledit && !diagramOrMergeEditor && inPivot); - documentHolder.mnuGroupPivot.setVisible(iscellmenu && !iscelledit && !diagramOrMergeEditor && inPivot); - documentHolder.mnuUnGroupPivot.setVisible(iscellmenu && !iscelledit && !diagramOrMergeEditor && inPivot); documentHolder.ssMenu.items[12].setVisible((iscellmenu||isallmenu||isinsparkline) && !iscelledit); documentHolder.pmiInsFunction.setVisible(iscellmenu && !iscelledit && !inPivot); documentHolder.pmiAddNamedRange.setVisible(iscellmenu && !iscelledit && !internaleditor); + var needshow = iscellmenu && !iscelledit && !diagramOrMergeEditor && inPivot; + + needshow && this.fillPivotProps(); + documentHolder.mnuRefreshPivot.setVisible(needshow); + documentHolder.mnuPivotRefreshSeparator.setVisible(needshow); + documentHolder.mnuSubtotalField.setVisible(!!this.propsPivot.field && (this.propsPivot.fieldType===0 || this.propsPivot.fieldType===1)); + documentHolder.mnuPivotSubtotalSeparator.setVisible(!!this.propsPivot.field && (this.propsPivot.fieldType===0 || this.propsPivot.fieldType===1)); + documentHolder.mnuGroupPivot.setVisible(needshow); + documentHolder.mnuUnGroupPivot.setVisible(needshow); + documentHolder.mnuDeleteField.setVisible(!!this.propsPivot.field); + documentHolder.mnuPivotDeleteSeparator.setVisible(!!this.propsPivot.field); + documentHolder.mnuPivotSettingsSeparator.setVisible(needshow); + documentHolder.mnuPivotSettings.setVisible(needshow); + documentHolder.mnuFieldSettings.setVisible(!!this.propsPivot.field); + documentHolder.mnuSummarize.setVisible(!!this.propsPivot.field && (this.propsPivot.fieldType===2)); + documentHolder.mnuShowAs.setVisible(!!this.propsPivot.field && (this.propsPivot.fieldType===2) && !this.propsPivot.rowTotal && !this.propsPivot.colTotal); + documentHolder.mnuPivotValueSeparator.setVisible(!!this.propsPivot.field && (this.propsPivot.fieldType===2)); + documentHolder.mnuPivotSort.setVisible(this.propsPivot.filter || this.propsPivot.rowFilter && this.propsPivot.colFilter); + documentHolder.mnuPivotFilter.setVisible(!!this.propsPivot.filter); + documentHolder.mnuPivotFilterSeparator.setVisible(this.propsPivot.filter || this.propsPivot.rowFilter && this.propsPivot.colFilter); + + if (this.propsPivot.field) { + documentHolder.mnuDeleteField.setCaption(documentHolder.txtDelField + ' ' + (this.propsPivot.rowTotal || this.propsPivot.colTotal ? documentHolder.txtGrandTotal : '"' + Common.Utils.String.htmlEncode(this.propsPivot.fieldName) + '"'), true); + documentHolder.mnuSubtotalField.setCaption(documentHolder.txtSubtotalField + ' "' + Common.Utils.String.htmlEncode(this.propsPivot.fieldName) + '"', true); + documentHolder.mnuFieldSettings.setCaption(this.propsPivot.fieldType===2 ? documentHolder.txtValueFieldSettings : documentHolder.txtFieldSettings); + if (this.propsPivot.fieldType===2) { + var sumval = this.propsPivot.field.asc_getSubtotal(); + for (var i = 0; i < documentHolder.mnuSummarize.menu.items.length; i++) { + var item = documentHolder.mnuSummarize.menu.items[i]; + (item.value!==undefined) && item.setChecked(item.value===sumval, true); + } + if (!this.propsPivot.rowTotal && !this.propsPivot.colTotal) { + sumval = this.propsPivot.field.asc_getShowDataAs(); + for (var i = 0; i < documentHolder.mnuShowAs.menu.items.length; i++) { + var item = documentHolder.mnuShowAs.menu.items[i]; + (item.value!==undefined) && item.setChecked(item.value===sumval, true); + } + } + } else { + documentHolder.mnuSubtotalField.setChecked(!!this.propsPivot.field.asc_getDefaultSubtotal(), true); + } + } + if (this.propsPivot.filter) { + documentHolder.mnuPivotFilter.menu.items[0].setCaption(this.propsPivot.fieldName ? Common.Utils.String.format(documentHolder.txtClearPivotField, ' "' + Common.Utils.String.htmlEncode(this.propsPivot.fieldName) + '"') : documentHolder.txtClear, true); // clear filter + documentHolder.mnuPivotFilter.menu.items[0].setDisabled(this.propsPivot.filter.asc_getFilterObj().asc_getType() === Asc.c_oAscAutoFilterTypes.None); // clear filter + } + if (isintable) { documentHolder.pmiInsertTable.menu.items[0].setDisabled(!formatTableInfo.asc_getIsInsertRowAbove()); documentHolder.pmiInsertTable.menu.items[1].setDisabled(!formatTableInfo.asc_getIsInsertRowBelow()); @@ -2365,7 +2692,7 @@ define([ /** coauthoring begin **/ var celcomments = cellinfo.asc_getComments(); // celcomments===null - has comment, but no permissions to view it - documentHolder.ssMenu.items[20].setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && celcomments && (celcomments.length < 1)); + documentHolder.pmiAddCommentSeparator.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && celcomments && (celcomments.length < 1)); documentHolder.pmiAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && celcomments && (celcomments.length < 1)); /** coauthoring end **/ documentHolder.pmiCellMenuSeparator.setVisible(iscellmenu && !iscelledit || isrowmenu || iscolmenu || isallmenu); @@ -2431,10 +2758,16 @@ define([ documentHolder.pmiGetRangeList.setDisabled(false); if (inPivot) { - var canGroup = this.api.asc_canGroupPivot(); - documentHolder.mnuGroupPivot.setDisabled(isPivotLocked || !canGroup || this._state.wsLock); - documentHolder.mnuUnGroupPivot.setDisabled(isPivotLocked || !canGroup || this._state.wsLock); + documentHolder.mnuGroupPivot.setDisabled(isPivotLocked || !this.propsPivot.canGroup || this._state.wsLock); + documentHolder.mnuUnGroupPivot.setDisabled(isPivotLocked || !this.propsPivot.canGroup || this._state.wsLock); documentHolder.mnuRefreshPivot.setDisabled(isPivotLocked || this._state.wsLock); + documentHolder.mnuPivotSettings.setDisabled(isPivotLocked || this._state.wsLock); + documentHolder.mnuFieldSettings.setDisabled(isPivotLocked || this._state.wsLock); + documentHolder.mnuDeleteField.setDisabled(isPivotLocked || this._state.wsLock); + documentHolder.mnuSubtotalField.setDisabled(isPivotLocked || this._state.wsLock); + documentHolder.mnuSummarize.setDisabled(isPivotLocked || this._state.wsLock); + documentHolder.mnuShowAs.setDisabled(isPivotLocked || this._state.wsLock); + documentHolder.mnuPivotFilter.setDisabled(isPivotLocked || this._state.wsLock); } if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event); @@ -4654,7 +4987,8 @@ define([ txtDataTableHint: 'Returns the data cells of the table or specified table columns', txtHeadersTableHint: 'Returns the column headers for the table or specified table columns', txtTotalsTableHint: 'Returns the total rows for the table or specified table columns', - txtCopySuccess: 'Link copied to the clipboard' + txtCopySuccess: 'Link copied to the clipboard', + warnFilterError: 'You need at least one field in the Values area in order to apply a value filter.' }, SSE.Controllers.DocumentHolder || {})); }); \ 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 0cfbabfb68..7b824a91d8 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3175,8 +3175,7 @@ define([ toolbar.lockToolbar(Common.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]}); this._state.inpivot = !!info.asc_getPivotTableInfo(); - toolbar.lockToolbar(Common.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort, - toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)}); + toolbar.lockToolbar(Common.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)}); toolbar.lockToolbar(Common.enumLock.noSlicerSource, !(this._state.inpivot || formatTableInfo), { array: [toolbar.btnInsertSlicer]}); need_disable = !this.appConfig.canModifyFilter; diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index 2e57fae714..9c97c7ab4d 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -595,7 +595,7 @@ define([ this.lblAnd.toggleClass('hidden', !isBetween); this.inputValue.$el.width(isBetween ? 100 : 225); var me = this; - _.defer(function () { + setTimeout(function () { if (me.inputValue) { me.inputValue.focus(); } @@ -615,7 +615,7 @@ define([ this.cmbFields.setVisible(this.type=='value'); this.cmbFields.on('selected', _.bind(function(combo, record) { var me = this; - _.defer(function () { + setTimeout(function () { if (me.inputValue) { me.inputValue.focus(); } @@ -910,16 +910,41 @@ define([ loadDefaults: function () { if (this.properties) { - var pivotObj = this.properties.asc_getPivotObj(), - idx = pivotObj.asc_getDataFieldIndexSorting(), - fields = pivotObj.asc_getDataFields(), - sort = this.properties.asc_getSortState(); + var idx = 0, + sort = Asc.c_oAscSortOptions.Ascending; - this.setTitle(this.txtTitle + ' (' + fields[0] + ')'); var arr = []; - fields && fields.forEach(function (item, index) { - item && arr.push({value: index, displayValue: item}); - }); + if (this.properties.filter) { + var filter = this.properties.filter, + pivotObj = filter.asc_getPivotObj(), + fields = pivotObj.asc_getDataFields(); + idx = pivotObj.asc_getDataFieldIndexSorting(); + sort = filter.asc_getSortState(); + fields && fields.forEach(function (item, index) { + item && arr.push({value: index, displayValue: item, filter: filter, indexSorting: index}); + }); + this.setTitle(this.txtTitle + ' (' + fields[0] + ')'); + } else { + this.setTitle(this.txtTitleValue); + var pivotObj = this.properties.rowFilter.asc_getPivotObj(), + fields = pivotObj.asc_getDataFields(), + idxRow = pivotObj.asc_getDataFieldIndexSorting(); + arr.push({value: 0, displayValue: fields[0], filter: this.properties.rowFilter, indexSorting: 1}); + + pivotObj = this.properties.colFilter.asc_getPivotObj(); + fields = pivotObj.asc_getDataFields(); + var idxCol = pivotObj.asc_getDataFieldIndexSorting(); + arr.push({value: 1, displayValue: fields[0], filter: this.properties.colFilter, indexSorting: 1}); + + if (idxRow>0 || idxRow===idxCol) { + idx = 0; + sort = this.properties.rowFilter.asc_getSortState(); + } else { + idx = 1; + sort = this.properties.colFilter.asc_getSortState(); + } + } + this.cmbFieldsAsc.setData(arr); this.cmbFieldsAsc.setValue((idx>=0) ? idx : 0); this.cmbFieldsDesc.setData(arr); @@ -927,15 +952,20 @@ define([ this.radioDesc.setValue(sort == Asc.c_oAscSortOptions.Descending, true); this.cmbFieldsDesc.setDisabled(sort !== Asc.c_oAscSortOptions.Descending); + this.cmbFieldsAsc.setDisabled(sort === Asc.c_oAscSortOptions.Descending); } }, save: function () { if (this.api && this.properties) { var combo = this.radioAsc.getValue() ? this.cmbFieldsAsc : this.cmbFieldsDesc; - var pivotObj = this.properties.asc_getPivotObj(); - pivotObj.asc_setDataFieldIndexSorting(combo.getValue()); - this.properties.asc_setSortState(this.radioAsc.getValue() ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending); - this.api.asc_applyAutoFilter(this.properties); + var rec = combo.getSelectedRecord(); + if (rec) { + var filter = rec.filter, + pivotObj = filter.asc_getPivotObj(); + pivotObj.asc_setDataFieldIndexSorting(rec.indexSorting); + filter.asc_setSortState(this.radioAsc.getValue() ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending); + this.api.asc_applyAutoFilter(filter); + } } }, @@ -946,6 +976,7 @@ define([ }, txtTitle: "Sort", + txtTitleValue: "Sort by value", textAsc: 'Ascenging (A to Z) by', textDesc: 'Descending (Z to A) by' @@ -1401,7 +1432,7 @@ define([ }); this.close(); - dlgSort.setSettings(this.configTo); + dlgSort.setSettings({filter : this.configTo}); dlgSort.show(); }, diff --git a/apps/spreadsheeteditor/main/app/view/DataTab.js b/apps/spreadsheeteditor/main/app/view/DataTab.js index bd48c26a45..c1b652b82d 100644 --- a/apps/spreadsheeteditor/main/app/view/DataTab.js +++ b/apps/spreadsheeteditor/main/app/view/DataTab.js @@ -239,7 +239,7 @@ define([ iconCls: 'toolbar__icon btn-custom-sort', caption: this.capBtnTextCustomSort, disabled: true, - lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter, _set.sheetLock, _set['Sort']], + lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.cantModifyFilter, _set.sheetLock, _set['Sort']], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index 548c1b6be0..f1fa019a77 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -349,6 +349,202 @@ define([ value : 'ungrouping' }); + me.mnuPivotSettings = new Common.UI.MenuItem({ + caption : this.txtPivotSettings + }); + + me.mnuFieldSettings = new Common.UI.MenuItem({ + caption : this.txtFieldSettings + }); + + me.mnuPivotFilter = new Common.UI.MenuItem({ + caption : this.txtFilter, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign : 'tl-tr', + items: [ + { + caption : me.txtClear, + value : 'clear' + },{ + caption : '--' + },{ + caption : me.txtTop10, + value : 'top10' + },{ + caption : me.txtValueFilter, + value : 'value' + },{ + caption : me.txtLabelFilter, + value : 'label' + } + ] + }) + }); + + me.mnuPivotSort = new Common.UI.MenuItem({ + caption : this.txtSort, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign : 'tl-tr', + items: [ + { + iconCls: 'menu__icon btn-sort-down', + caption : me.txtAscending, + value : Asc.c_oAscSortOptions.Ascending + },{ + iconCls: 'menu__icon btn-sort-up', + caption : me.txtDescending, + value : Asc.c_oAscSortOptions.Descending + },{ + caption : me.txtSortOption, + value : 'advanced' + } + ] + }) + }); + + me.mnuDeleteField = new Common.UI.MenuItem({ + caption : this.txtDelField + }); + + me.mnuSubtotalField = new Common.UI.MenuItem({ + caption : this.txtSubtotalField, + checkable: true, + allowDepress: true + }); + + me.mnuSummarize = new Common.UI.MenuItem({ + caption : this.txtSummarize, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign : 'tl-tr', + items: [ + { + caption : me.txtSum, + value : Asc.c_oAscDataConsolidateFunction.Sum, + checkable: true + },{ + caption : me.txtCount, + value : Asc.c_oAscDataConsolidateFunction.Count, + checkable: true + },{ + caption : me.txtAverage, + value : Asc.c_oAscDataConsolidateFunction.Average, + checkable: true + },{ + caption : me.txtMax, + value : Asc.c_oAscDataConsolidateFunction.Max, + checkable: true + },{ + caption : me.txtMin, + value : Asc.c_oAscDataConsolidateFunction.Min, + checkable: true + },{ + caption : me.txtProduct, + value : Asc.c_oAscDataConsolidateFunction.Product, + checkable: true + },{ + caption : '--' + },{ + caption : me.txtMoreOptions, + value: -1 + } + ] + }) + }); + + me.mnuShowAs = new Common.UI.MenuItem({ + caption : this.txtShowAs, + menu : new Common.UI.Menu({ + cls: 'shifted-right', + menuAlign : 'tl-tr', + items: [ + { + caption : me.txtNormal, + value : Asc.c_oAscShowDataAs.Normal, + checkable: true + },{ + caption : me.txtPercentOfGrand, + value : Asc.c_oAscShowDataAs.PercentOfTotal, + checkable: true + },{ + caption : me.txtPercentOfCol, + value : Asc.c_oAscShowDataAs.PercentOfCol, + checkable: true + },{ + caption : me.txtPercentOfTotal, + value : Asc.c_oAscShowDataAs.PercentOfRow, + checkable: true + },{ + caption : me.txtPercent, + value : Asc.c_oAscShowDataAs.Percent, + showMore: true, + checkable: true + },{ + caption : me.txtPercentOfParentRow, + value : Asc.c_oAscShowDataAs.PercentOfParentRow, + checkable: true + },{ + caption : me.txtPercentOfParentCol, + value : Asc.c_oAscShowDataAs.PercentOfParentCol, + checkable: true + },{ + caption : me.txtPercentOfParent, + value : Asc.c_oAscShowDataAs.PercentOfParent, + showMore: true, + checkable: true + },{ + caption : me.txtDifference, + value : Asc.c_oAscShowDataAs.Difference, + showMore: true, + checkable: true + },{ + caption : me.txtPercentDiff, + value : Asc.c_oAscShowDataAs.PercentDiff, + showMore: true, + checkable: true + },{ + caption : me.txtRunTotal, + value : Asc.c_oAscShowDataAs.RunTotal, + showMore: true, + checkable: true + },{ + caption : me.txtPercentOfRunTotal, + value : Asc.c_oAscShowDataAs.PercentOfRunningTotal, + showMore: true, + checkable: true + },{ + caption : me.txtRankAscending, + value : Asc.c_oAscShowDataAs.RankAscending, + showMore: true, + checkable: true + },{ + caption : me.txtRankDescending, + value : Asc.c_oAscShowDataAs.RankDescending, + showMore: true, + checkable: true + },{ + caption : me.txtIndex, + value : Asc.c_oAscShowDataAs.Index, + checkable: true + },{ + caption : '--' + },{ + caption : me.txtMoreOptions, + value: -1 + } + ] + }) + }); + + me.mnuPivotRefreshSeparator = new Common.UI.MenuItem({caption: '--'}); + me.mnuPivotSubtotalSeparator = new Common.UI.MenuItem({caption: '--'}); + me.mnuPivotSettingsSeparator = new Common.UI.MenuItem({caption: '--'}); + me.mnuPivotDeleteSeparator = new Common.UI.MenuItem({caption: '--'}); + me.mnuPivotValueSeparator = new Common.UI.MenuItem({caption: '--'}); + me.mnuPivotFilterSeparator = new Common.UI.MenuItem({caption: '--'}); + me.pmiInsFunction = new Common.UI.MenuItem({ iconCls: 'menu__icon btn-function', caption : me.txtFormula @@ -420,9 +616,13 @@ define([ caption : me.txtAddComment }); + me.pmiAddCommentSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + me.pmiCellMenuSeparator = new Common.UI.MenuItem({ caption : '--' - }) + }); me.pmiFunctionSeparator = new Common.UI.MenuItem({ caption : '--' @@ -586,9 +786,23 @@ define([ me.pmiFilterCells, me.pmiReapply, me.mnuRefreshPivot, + me.mnuPivotRefreshSeparator, + me.mnuPivotSort, + me.mnuPivotFilter, + me.mnuPivotFilterSeparator, + me.mnuSubtotalField, + me.mnuPivotSubtotalSeparator, me.mnuGroupPivot, me.mnuUnGroupPivot, - {caption: '--'}, + me.mnuPivotDeleteSeparator, + me.mnuDeleteField, + me.mnuPivotValueSeparator, + me.mnuSummarize, + me.mnuShowAs, + me.mnuPivotSettingsSeparator, + me.mnuFieldSettings, + me.mnuPivotSettings, + me.pmiAddCommentSeparator, me.pmiAddComment, me.pmiCellMenuSeparator, me.pmiNumFormat, @@ -1395,7 +1609,42 @@ define([ currProfText: 'Current - Professional', currLinearText: 'Current - Linear', allProfText: 'All - Professional', - allLinearText: 'All - Linear' + allLinearText: 'All - Linear', + txtPivotSettings: 'Pivot Table settings', + txtFieldSettings: 'Field settings', + txtValueFieldSettings: 'Value field settings', + txtDelField: 'Remove', + txtSubtotalField: 'Subtotal', + txtGrandTotal: 'Grand total', + txtSummarize: 'Summarize values by', + txtShowAs: 'Show values as', + txtMoreOptions: 'More options', + txtSum: 'Sum', + txtAverage: 'Average', + txtCount: 'Count', + txtMax: 'Max', + txtMin: 'Min', + txtProduct: 'Product', + txtNormal: 'No calculation', + txtDifference: 'The difference from', + txtPercent: '% of', + txtPercentDiff: '% difference from', + txtRunTotal: 'Running total in', + txtPercentOfRunTotal: '% running total in', + txtPercentOfCol: '% of column total', + txtPercentOfTotal: '% of row total', + txtPercentOfGrand: '% of grand total', + txtIndex: 'Index', + txtPercentOfParentRow: '% of parent row total', + txtPercentOfParentCol: '% of parent column total', + txtPercentOfParent: '% of parent total', + txtRankAscending: 'Rank smallest to largest', + txtRankDescending: 'Rank largest to smallest', + txtValueFilter: 'Value filters', + txtLabelFilter: 'Label filters', + txtTop10: 'Top 10', + txtClearPivotField: 'Clear filter from {0}', + txtSortOption: 'More sort options' }, SSE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FieldSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/FieldSettingsDialog.js index f281e10508..a4b1a1efba 100644 --- a/apps/spreadsheeteditor/main/app/view/FieldSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/FieldSettingsDialog.js @@ -73,7 +73,6 @@ define([ 'text!spreadsheeteditor/main/app/template/FieldSettingsDialog.templa this.handler = options.handler; this.props = options.props; this.fieldIndex = options.fieldIndex || 0; - this.names = options.names || []; this.type = options.type || 0; // 0 - columns, 1 - rows, 3 - filters Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); diff --git a/apps/spreadsheeteditor/main/app/view/PivotSettings.js b/apps/spreadsheeteditor/main/app/view/PivotSettings.js index c3b2bfdd37..3d93158d56 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PivotSettings.js @@ -787,7 +787,6 @@ define([ { props: me._originalProps, field: field, - names: me._state.names, api: me.api, handler: function(result, value) { if (result == 'ok' && me.api && value) { @@ -805,7 +804,6 @@ define([ { props: me._originalProps, fieldIndex: pivotIndex, - names: me._state.names, api: me.api, type: me._state.field.type, handler: function(result, value) { diff --git a/apps/spreadsheeteditor/main/app/view/ValueFieldSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/ValueFieldSettingsDialog.js index 5a825f2593..11fbcf355c 100644 --- a/apps/spreadsheeteditor/main/app/view/ValueFieldSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ValueFieldSettingsDialog.js @@ -107,8 +107,8 @@ define([ this.handler = options.handler; this.props = options.props; this.field = options.field || 0; - this.names = options.names || []; - + this.showAsValue = options.showAsValue; + this.baseFieldChanged = false; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, @@ -227,13 +227,16 @@ define([ this.cmbShowAs.setValue(show_as); var data = []; - this.names.forEach(function(item, index){ - data.push({value: index, displayValue: item}); + this.pivot_names.forEach(function (item, index) { + data.push({value: index, displayValue: item.asc_getName() || me.cache_names[index].asc_getName()}); }); + + var defValue = this.api.asc_getPivotShowValueAsInfo(Asc.c_oAscShowDataAs.Difference); this.cmbBaseField.setData(data); - this.cmbBaseField.setValue(field.asc_getBaseField(), ''); - this.cmbBaseField.setDisabled(show_as === Asc.c_oAscShowDataAs.Normal || show_as === Asc.c_oAscShowDataAs.PercentOfTotal || show_as === Asc.c_oAscShowDataAs.PercentOfRow || - show_as === Asc.c_oAscShowDataAs.PercentOfCol || show_as === Asc.c_oAscShowDataAs.PercentOfParentRow || show_as === Asc.c_oAscShowDataAs.PercentOfParentCol || show_as === Asc.c_oAscShowDataAs.Index); + var disabled = (show_as === Asc.c_oAscShowDataAs.Normal || show_as === Asc.c_oAscShowDataAs.PercentOfTotal || show_as === Asc.c_oAscShowDataAs.PercentOfRow || show_as === Asc.c_oAscShowDataAs.PercentOfCol || + show_as === Asc.c_oAscShowDataAs.PercentOfParentRow || show_as === Asc.c_oAscShowDataAs.PercentOfParentCol || show_as === Asc.c_oAscShowDataAs.Index); + this.cmbBaseField.setDisabled(disabled); + this.cmbBaseField.setValue(disabled ? defValue.asc_getBaseField() : field.asc_getBaseField() , ''); data = []; var baseitems = this.pivot_names[field.asc_getBaseField()].asc_getBaseItemObject(this.cache_names[field.asc_getBaseField()]); @@ -244,6 +247,11 @@ define([ this.cmbBaseItem.setDisabled(data.length<1 || show_as !== Asc.c_oAscShowDataAs.Difference && show_as !== Asc.c_oAscShowDataAs.Percent && show_as !== Asc.c_oAscShowDataAs.PercentDiff); this.cmbBaseItem.setValue((data.length>0) && (show_as === Asc.c_oAscShowDataAs.Difference || show_as === Asc.c_oAscShowDataAs.Percent || show_as === Asc.c_oAscShowDataAs.PercentDiff) ? field.asc_getBaseItem() : '', ''); } + + if (this.showAsValue!==undefined) { + this.cmbShowAs.setValue(this.showAsValue); + this.onShowAsSelect(this.cmbShowAs, this.cmbShowAs.getSelectedRecord()); + } }, getSettings: function () { @@ -280,16 +288,27 @@ define([ }, onShowAsSelect: function(combo, record) { - var show_as = record.value; - this.cmbBaseField.setDisabled(show_as === Asc.c_oAscShowDataAs.Normal || show_as === Asc.c_oAscShowDataAs.PercentOfTotal || show_as === Asc.c_oAscShowDataAs.PercentOfRow || - show_as === Asc.c_oAscShowDataAs.PercentOfCol || show_as === Asc.c_oAscShowDataAs.PercentOfParentRow || show_as === Asc.c_oAscShowDataAs.PercentOfParentCol || show_as === Asc.c_oAscShowDataAs.Index); - + var show_as = record.value, + disabled = (show_as === Asc.c_oAscShowDataAs.Normal || show_as === Asc.c_oAscShowDataAs.PercentOfTotal || show_as === Asc.c_oAscShowDataAs.PercentOfRow || show_as === Asc.c_oAscShowDataAs.PercentOfCol || + show_as === Asc.c_oAscShowDataAs.PercentOfParentRow || show_as === Asc.c_oAscShowDataAs.PercentOfParentCol || show_as === Asc.c_oAscShowDataAs.Index); + this.cmbBaseField.setDisabled(disabled); + if (!this.baseFieldChanged) { + var defValue = this.api.asc_getPivotShowValueAsInfo(show_as); + this.cmbBaseField.setValue(defValue.asc_getBaseField(), ''); + this.cmbBaseField.getSelectedRecord() && this.changeBaseField(defValue.asc_getBaseItem()); + } else { + this.cmbBaseItem.setValue((show_as === Asc.c_oAscShowDataAs.Difference || show_as === Asc.c_oAscShowDataAs.Percent || show_as === Asc.c_oAscShowDataAs.PercentDiff) && this.cmbBaseItem.store.length>0 ? + this.cmbBaseItem.store.at(this.cmbBaseItem.store.length>2 ? 2 : 0).get('value') : '', ''); + } this.cmbBaseItem.setDisabled(this.cmbBaseItem.store.length<1 || show_as !== Asc.c_oAscShowDataAs.Difference && show_as !== Asc.c_oAscShowDataAs.Percent && show_as !== Asc.c_oAscShowDataAs.PercentDiff); - this.cmbBaseItem.setValue((show_as === Asc.c_oAscShowDataAs.Difference || show_as === Asc.c_oAscShowDataAs.Percent || show_as === Asc.c_oAscShowDataAs.PercentDiff) && this.cmbBaseItem.store.length>0 ? - this.cmbBaseItem.store.at(0).get('value') : '', ''); }, onBaseFieldSelect: function(combo, record) { + this.changeBaseField(); + this.baseFieldChanged = true; + }, + + changeBaseField: function(value) { var field = this.cmbBaseField.getValue(), baseitems = this.pivot_names[field].asc_getBaseItemObject(this.cache_names[field]), data = [], @@ -298,10 +317,13 @@ define([ data.push({value: item["baseItem"], displayValue: index===0 ? me.textPrev : (index===1 ? me.textNext : item["name"])}); }); this.cmbBaseItem.setData(data); + if (value===undefined && data.length>0) { + value = this.cmbBaseItem.store.at(data.length>2 ? 2 : 0).get('value'); + } var show_as = this.cmbShowAs.getValue(); this.cmbBaseItem.setDisabled(data.length<1 || show_as !== Asc.c_oAscShowDataAs.Difference && show_as !== Asc.c_oAscShowDataAs.Percent && show_as !== Asc.c_oAscShowDataAs.PercentDiff); - this.cmbBaseItem.setValue((show_as === Asc.c_oAscShowDataAs.Difference || show_as === Asc.c_oAscShowDataAs.Percent || show_as === Asc.Asc.c_oAscShowDataAs.PercentDiff) && data.length>0 ? - this.cmbBaseItem.store.at(0).get('value') : '', ''); + this.cmbBaseItem.setValue((show_as === Asc.c_oAscShowDataAs.Difference || show_as === Asc.c_oAscShowDataAs.Percent || show_as === Asc.c_oAscShowDataAs.PercentDiff) && data.length>0 ? + value : '', ''); }, onBaseItemSelect: function(combo, record) { diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 1390582396..d211689b22 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -834,6 +834,7 @@ "SSE.Controllers.DocumentHolder.txtUseTextImport": "Use text import wizard", "SSE.Controllers.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.
Are you sure you want to continue?", "SSE.Controllers.DocumentHolder.txtWidth": "Width", + "SSE.Controllers.DocumentHolder.warnFilterError": "You need at least one field in the Values area in order to apply a value filter.", "SSE.Controllers.FormulaDialog.sCategoryAll": "All", "SSE.Controllers.FormulaDialog.sCategoryCube": "Cube", "SSE.Controllers.FormulaDialog.sCategoryDatabase": "Database", @@ -2299,6 +2300,41 @@ "SSE.Views.DocumentHolder.txtWidth": "Width", "SSE.Views.DocumentHolder.unicodeText": "Unicode", "SSE.Views.DocumentHolder.vertAlignText": "Vertical alignment", + "SSE.Views.DocumentHolder.txtPivotSettings": "Pivot Table settings", + "SSE.Views.DocumentHolder.txtFieldSettings": "Field settings", + "SSE.Views.DocumentHolder.txtValueFieldSettings": "Value field settings", + "SSE.Views.DocumentHolder.txtDelField": "Remove", + "SSE.Views.DocumentHolder.txtSubtotalField": "Subtotal", + "SSE.Views.DocumentHolder.txtGrandTotal": "Grand total", + "SSE.Views.DocumentHolder.txtSummarize": "Summarize values by", + "SSE.Views.DocumentHolder.txtShowAs": "Show values as", + "SSE.Views.DocumentHolder.txtMoreOptions": "More options", + "SSE.Views.DocumentHolder.txtSum": "Sum", + "SSE.Views.DocumentHolder.txtAverage": "Average", + "SSE.Views.DocumentHolder.txtCount": "Count", + "SSE.Views.DocumentHolder.txtMax": "Max", + "SSE.Views.DocumentHolder.txtMin": "Min", + "SSE.Views.DocumentHolder.txtProduct": "Product", + "SSE.Views.DocumentHolder.txtNormal": "No calculation", + "SSE.Views.DocumentHolder.txtDifference": "The difference from", + "SSE.Views.DocumentHolder.txtPercent": "% of", + "SSE.Views.DocumentHolder.txtPercentDiff": "% difference from", + "SSE.Views.DocumentHolder.txtRunTotal": "Running total in", + "SSE.Views.DocumentHolder.txtPercentOfRunTotal": "% running total in", + "SSE.Views.DocumentHolder.txtPercentOfCol": "% of column total", + "SSE.Views.DocumentHolder.txtPercentOfTotal": "% of row total", + "SSE.Views.DocumentHolder.txtPercentOfGrand": "% of grand total", + "SSE.Views.DocumentHolder.txtIndex": "Index", + "SSE.Views.DocumentHolder.txtPercentOfParentRow": "% of parent row total", + "SSE.Views.DocumentHolder.txtPercentOfParentCol": "% of parent column total", + "SSE.Views.DocumentHolder.txtPercentOfParent": "% of parent total", + "SSE.Views.DocumentHolder.txtRankAscending": "Rank smallest to largest", + "SSE.Views.DocumentHolder.txtRankDescending": "Rank largest to smallest", + "SSE.Views.DocumentHolder.txtValueFilter": "Value filters", + "SSE.Views.DocumentHolder.txtLabelFilter": "Label filters", + "SSE.Views.DocumentHolder.txtTop10": "Top 10", + "SSE.Views.DocumentHolder.txtClearPivotField": "Clear filter from {0}", + "SSE.Views.DocumentHolder.txtSortOption": "More sort options", "SSE.Views.ExternalLinksDlg.closeButtonText": "Close", "SSE.Views.ExternalLinksDlg.textDelete": "Break links", "SSE.Views.ExternalLinksDlg.textDeleteAll": "Break all links", @@ -3449,6 +3485,7 @@ "SSE.Views.SortFilterDialog.textAsc": "Ascending (A to Z) by", "SSE.Views.SortFilterDialog.textDesc": "Descending (Z to A) by", "SSE.Views.SortFilterDialog.txtTitle": "Sort", + "SSE.Views.SortFilterDialog.txtTitleValue": "Sort by value", "SSE.Views.SortOptionsDialog.textCase": "Case sensitive", "SSE.Views.SortOptionsDialog.textHeaders": "My data has headers", "SSE.Views.SortOptionsDialog.textLeftRight": "Sort left to right", @@ -3936,15 +3973,15 @@ "SSE.Views.ValueFieldSettingsDialog.txtMax": "Max", "SSE.Views.ValueFieldSettingsDialog.txtMin": "Min", "SSE.Views.ValueFieldSettingsDialog.txtNormal": "No calculation", - "SSE.Views.ValueFieldSettingsDialog.txtPercent": "Percent of", - "SSE.Views.ValueFieldSettingsDialog.txtPercentDiff": "Percent difference from", - "SSE.Views.ValueFieldSettingsDialog.txtPercentOfCol": "Percent of column", + "SSE.Views.ValueFieldSettingsDialog.txtPercent": "% of", + "SSE.Views.ValueFieldSettingsDialog.txtPercentDiff": "% difference from", + "SSE.Views.ValueFieldSettingsDialog.txtPercentOfCol": "% of column", "SSE.Views.ValueFieldSettingsDialog.txtPercentOfGrand": "% of grand total", "SSE.Views.ValueFieldSettingsDialog.txtPercentOfParent": "% of parent total", "SSE.Views.ValueFieldSettingsDialog.txtPercentOfParentCol": "% of parent column total", "SSE.Views.ValueFieldSettingsDialog.txtPercentOfParentRow": "% of parent row total", "SSE.Views.ValueFieldSettingsDialog.txtPercentOfRunTotal": "% running total in", - "SSE.Views.ValueFieldSettingsDialog.txtPercentOfTotal": "Percent of row", + "SSE.Views.ValueFieldSettingsDialog.txtPercentOfTotal": "% of row", "SSE.Views.ValueFieldSettingsDialog.txtProduct": "Product", "SSE.Views.ValueFieldSettingsDialog.txtRankAscending": "Rank smallest to largest", "SSE.Views.ValueFieldSettingsDialog.txtRankDescending": "Rank largest to smallest",