Commit 0484c140 authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] Изменение диапазона для форматированной таблицы.

parent a3b8ab09
......@@ -31,8 +31,8 @@ define([
this.template = [
'<div class="box">',
'<div id="id-dlg-tableoptions-range" class="input-row" style="margin-bottom: 10px;"></div>',
'<div class="input-row" id="id-dlg-tableoptions-title"></div>',
'<div id="id-dlg-tableoptions-range" class="input-row" style="margin-bottom: 5px;"></div>',
'<div class="input-row" id="id-dlg-tableoptions-title" style="margin-top: 5px;"></div>',
'</div>',
'<div class="footer right">',
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + '</button>',
......@@ -41,6 +41,7 @@ define([
].join('');
this.options.tpl = _.template(this.template, this.options);
this.checkRangeType = c_oAscSelectionDialogType.FormatTable;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
......@@ -82,30 +83,37 @@ define([
if (settings.api) {
me.api = settings.api;
var options = me.api.asc_getAddFormatTableOptions();
this.inputRange.setValue(options.asc_getRange());
this.cbTitle.setValue(options.asc_getIsTitle());
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());
}
me.api.asc_setSelectionDialogMode(c_oAscSelectionDialogType.FormatTable, options.asc_getRange());
me.api.asc_unregisterCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me));
me.api.asc_registerCallback('asc_onSelectionRangeChanged', _.bind(me.onApiRangeChanged, me));
Common.NotificationCenter.trigger('cells:range', c_oAscSelectionDialogType.FormatTable);
}
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;
};
},
getSettings: function () {
var options = this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());
// options.asc_setRange(this.inputRange.getValue());
options.asc_setIsTitle(this.cbTitle.checked);
return options;
if (this.checkRangeType == c_oAscSelectionDialogType.FormatTable) {
var options = this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());
options.asc_setIsTitle(this.cbTitle.checked);
return options;
} else
return this.inputRange.getValue();
},
onApiRangeChanged: function(info) {
......@@ -115,7 +123,7 @@ define([
},
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)
return true;
else {
......
......@@ -382,13 +382,12 @@ define([
},
onSelectData: function() {
return;
var me = this;
if (me.api) {
var handlerDlg = function(dlg, result) {
if (result == 'ok') {
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);
......@@ -399,7 +398,8 @@ define([
win.show();
win.setSettings({
api : me.api
api : me.api,
range : me._state.Range
});
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment