From 18ab1486338cecad6955a9bd1bb171323c3703bb Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Thu, 3 Oct 2019 15:30:43 +0300 Subject: [PATCH] [SSE] Sync with sdk api changes --- .../main/app/controller/PivotTable.js | 6 +++++- .../spreadsheeteditor/main/app/view/PivotSettings.js | 12 +++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index c19a0a39e..c877d2d0c 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -153,7 +153,11 @@ define([ onCreateClick: function(btn, opts){ if (this.api) { - this.api.asc_insertPivot("Sheet1!B2:H13", this.createSheetName()); + var options = this.api.asc_getAddPivotTableOptions(); + if (options) { + this.api.asc_insertPivotNewWorksheet(options.asc_getRange(), this.createSheetName()); + // this.api.asc_insertPivotExistingWorksheet(options.asc_getRange(), "Sheet1!B17:B17"); + } } Common.NotificationCenter.trigger('edit:complete', this); }, diff --git a/apps/spreadsheeteditor/main/app/view/PivotSettings.js b/apps/spreadsheeteditor/main/app/view/PivotSettings.js index 0b92a35f6..b54c42671 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PivotSettings.js @@ -593,7 +593,8 @@ define([ var win; if (me.api && !this._locked && me._state.field){ if (me._state.field.type == 2) { // value field - var field = me._originalProps.asc_getDataFields()[me._state.field.record.get('index')]; + var dataIndex = me._state.field.record.get('index'); + var field = me._originalProps.asc_getDataFields()[dataIndex]; (new SSE.Views.ValueFieldSettingsDialog( { props: me._originalProps, @@ -602,24 +603,25 @@ define([ api: me.api, handler: function(result, value) { if (result == 'ok' && me.api && value) { - field.asc_set(me.api, me._originalProps, value); + field.asc_set(me.api, me._originalProps, dataIndex, value); } Common.NotificationCenter.trigger('edit:complete', me); } })).show(); } else { - var pivotField = me._originalProps.asc_getPivotFields()[me._state.field.record.get('pivotIndex')]; + var pivotIndex = me._state.field.record.get('pivotIndex'); + var pivotField = me._originalProps.asc_getPivotFields()[pivotIndex]; (new SSE.Views.FieldSettingsDialog( { props: me._originalProps, - fieldIndex: me._state.field.record.get('pivotIndex'), + fieldIndex: pivotIndex, names: me._state.names, api: me.api, type: me._state.field.type, handler: function(result, value) { if (result == 'ok' && me.api && value) { - pivotField.asc_set(me.api, me._originalProps, value); + pivotField.asc_set(me.api, me._originalProps, pivotIndex, value); } Common.NotificationCenter.trigger('edit:complete', me);