[SSE] Изменение диапазона для форматированной таблицы.
This commit is contained in:
parent
a3b8ab09ff
commit
0484c1407a
|
@ -31,8 +31,8 @@ define([
|
||||||
|
|
||||||
this.template = [
|
this.template = [
|
||||||
'<div class="box">',
|
'<div class="box">',
|
||||||
'<div id="id-dlg-tableoptions-range" class="input-row" style="margin-bottom: 10px;"></div>',
|
'<div id="id-dlg-tableoptions-range" class="input-row" style="margin-bottom: 5px;"></div>',
|
||||||
'<div class="input-row" id="id-dlg-tableoptions-title"></div>',
|
'<div class="input-row" id="id-dlg-tableoptions-title" style="margin-top: 5px;"></div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
'<div class="footer right">',
|
'<div class="footer right">',
|
||||||
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
|
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
|
||||||
|
@ -41,6 +41,7 @@ define([
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
this.options.tpl = _.template(this.template, this.options);
|
this.options.tpl = _.template(this.template, this.options);
|
||||||
|
this.checkRangeType = c_oAscSelectionDialogType.FormatTable;
|
||||||
|
|
||||||
Common.UI.Window.prototype.initialize.call(this, this.options);
|
Common.UI.Window.prototype.initialize.call(this, this.options);
|
||||||
},
|
},
|
||||||
|
@ -82,30 +83,37 @@ define([
|
||||||
if (settings.api) {
|
if (settings.api) {
|
||||||
me.api = settings.api;
|
me.api = settings.api;
|
||||||
|
|
||||||
var options = me.api.asc_getAddFormatTableOptions();
|
if (settings.range) {
|
||||||
|
me.cbTitle.setVisible(false);
|
||||||
|
me.setHeight(130);
|
||||||
|
me.checkRangeType = c_oAscSelectionDialogType.FormatTableChangeRange;
|
||||||
|
me.inputRange.setValue(settings.range);
|
||||||
|
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.FormatTable, settings.range);
|
||||||
|
} else {
|
||||||
|
var options = me.api.asc_getAddFormatTableOptions();
|
||||||
|
me.inputRange.setValue(options.asc_getRange());
|
||||||
|
me.cbTitle.setValue(options.asc_getIsTitle());
|
||||||
|
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.FormatTable, options.asc_getRange());
|
||||||
|
}
|
||||||
|
|
||||||
this.inputRange.setValue(options.asc_getRange());
|
|
||||||
this.cbTitle.setValue(options.asc_getIsTitle());
|
|
||||||
|
|
||||||
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.FormatTable, options.asc_getRange());
|
|
||||||
me.api.asc_unregisterCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me));
|
me.api.asc_unregisterCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me));
|
||||||
me.api.asc_registerCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me));
|
me.api.asc_registerCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me));
|
||||||
Common.NotificationCenter.trigger('cells:range', c_oAscSelectionDialogType.FormatTable);
|
Common.NotificationCenter.trigger('cells:range', c_oAscSelectionDialogType.FormatTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
me.inputRange.validation = function(value) {
|
me.inputRange.validation = function(value) {
|
||||||
var isvalid = me.api.asc_checkDataRange(c_oAscSelectionDialogType.FormatTable, value, false);
|
var isvalid = me.api.asc_checkDataRange(me.checkRangeType, value, false);
|
||||||
return (isvalid==c_oAscError.ID.DataRangeError) ? me.txtInvalidRange : true;
|
return (isvalid==c_oAscError.ID.DataRangeError) ? me.txtInvalidRange : true;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getSettings: function () {
|
getSettings: function () {
|
||||||
var options = this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());
|
if (this.checkRangeType == c_oAscSelectionDialogType.FormatTable) {
|
||||||
|
var options = this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());
|
||||||
// options.asc_setRange(this.inputRange.getValue());
|
options.asc_setIsTitle(this.cbTitle.checked);
|
||||||
options.asc_setIsTitle(this.cbTitle.checked);
|
return options;
|
||||||
|
} else
|
||||||
return options;
|
return this.inputRange.getValue();
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiRangeChanged: function(info) {
|
onApiRangeChanged: function(info) {
|
||||||
|
@ -115,7 +123,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
isRangeValid: function() {
|
isRangeValid: function() {
|
||||||
var isvalid = this.api.asc_checkDataRange(c_oAscSelectionDialogType.FormatTable, this.inputRange.getValue(), true);
|
var isvalid = this.api.asc_checkDataRange(this.checkRangeType, this.inputRange.getValue(), true);
|
||||||
if (isvalid == c_oAscError.ID.No)
|
if (isvalid == c_oAscError.ID.No)
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -382,13 +382,12 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectData: function() {
|
onSelectData: function() {
|
||||||
return;
|
|
||||||
var me = this;
|
var me = this;
|
||||||
if (me.api) {
|
if (me.api) {
|
||||||
var handlerDlg = function(dlg, result) {
|
var handlerDlg = function(dlg, result) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.None);
|
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.None);
|
||||||
// me.api.asc_changeAutoFilter(me._state.TableName, c_oAscChangeFilterOptions.style, fmtname);
|
me.api.asc_changeTableRange(me._state.TableName, dlg.getSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||||
|
@ -399,7 +398,8 @@ define([
|
||||||
|
|
||||||
win.show();
|
win.show();
|
||||||
win.setSettings({
|
win.setSettings({
|
||||||
api : me.api
|
api : me.api,
|
||||||
|
range : me._state.Range
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue