[SSE] Show warning before deleting named range
This commit is contained in:
parent
61e2292801
commit
254a57b834
|
@ -290,6 +290,8 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
},
|
},
|
||||||
|
|
||||||
onEditRange: function (isEdit) {
|
onEditRange: function (isEdit) {
|
||||||
|
if (this._isWarningVisible) return;
|
||||||
|
|
||||||
if (this.locked) {
|
if (this.locked) {
|
||||||
Common.NotificationCenter.trigger('namedrange:locked');
|
Common.NotificationCenter.trigger('namedrange:locked');
|
||||||
return;
|
return;
|
||||||
|
@ -328,8 +330,20 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
onDeleteRange: function () {
|
onDeleteRange: function () {
|
||||||
var rec = this.rangeList.getSelectedRec();
|
var rec = this.rangeList.getSelectedRec();
|
||||||
if (rec) {
|
if (rec) {
|
||||||
this.currentNamedRange = _.indexOf(this.rangeList.store.models, rec);
|
var me = this;
|
||||||
this.api.asc_delDefinedNames(new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('type'), undefined, undefined, undefined, true));
|
me._isWarningVisible = true;
|
||||||
|
Common.UI.warning({
|
||||||
|
msg: Common.Utils.String.format(me.warnDelete, rec.get('name')),
|
||||||
|
buttons: ['ok', 'cancel'],
|
||||||
|
callback: function(btn) {
|
||||||
|
if (btn == 'ok') {
|
||||||
|
me.currentNamedRange = _.indexOf(me.rangeList.store.models, rec);
|
||||||
|
me.api.asc_delDefinedNames(new Asc.asc_CDefName(rec.get('name'), rec.get('range'), rec.get('scope'), rec.get('type'), undefined, undefined, undefined, true));
|
||||||
|
}
|
||||||
|
setTimeout(function(){ me.getDefaultFocusableComponent().focus(); }, 100);
|
||||||
|
me._isWarningVisible = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -436,7 +450,8 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
|
||||||
textFilterWorkbook: 'Names Scoped to Workbook',
|
textFilterWorkbook: 'Names Scoped to Workbook',
|
||||||
textWorkbook: 'Workbook',
|
textWorkbook: 'Workbook',
|
||||||
guestText: 'Guest',
|
guestText: 'Guest',
|
||||||
tipIsLocked: 'This element is being edited by another user.'
|
tipIsLocked: 'This element is being edited by another user.',
|
||||||
|
warnDelete: 'Are you sure you want to delete the name {0}?'
|
||||||
|
|
||||||
}, SSE.Views.NameManagerDlg || {}));
|
}, SSE.Views.NameManagerDlg || {}));
|
||||||
});
|
});
|
|
@ -2162,6 +2162,7 @@
|
||||||
"SSE.Views.NameManagerDlg.textWorkbook": "Workbook",
|
"SSE.Views.NameManagerDlg.textWorkbook": "Workbook",
|
||||||
"SSE.Views.NameManagerDlg.tipIsLocked": "This element is being edited by another user.",
|
"SSE.Views.NameManagerDlg.tipIsLocked": "This element is being edited by another user.",
|
||||||
"SSE.Views.NameManagerDlg.txtTitle": "Name Manager",
|
"SSE.Views.NameManagerDlg.txtTitle": "Name Manager",
|
||||||
|
"SSE.Views.NameManagerDlg.warnDelete": "Are you sure you want to delete the name {0}?",
|
||||||
"SSE.Views.PageMarginsDialog.textBottom": "Bottom",
|
"SSE.Views.PageMarginsDialog.textBottom": "Bottom",
|
||||||
"SSE.Views.PageMarginsDialog.textLeft": "Left",
|
"SSE.Views.PageMarginsDialog.textLeft": "Left",
|
||||||
"SSE.Views.PageMarginsDialog.textRight": "Right",
|
"SSE.Views.PageMarginsDialog.textRight": "Right",
|
||||||
|
|
Loading…
Reference in a new issue