Merge pull request #630 from ONLYOFFICE/fix/data-validation

Fix/data validation
This commit is contained in:
Julia Radzhabova 2020-12-23 15:24:15 +03:00 committed by GitHub
commit 8460175ed5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -170,9 +170,10 @@ define([ 'text!spreadsheeteditor/main/app/template/DataValidationDialog.templ
this.chApply = new Common.UI.CheckBox({ this.chApply = new Common.UI.CheckBox({
el: $window.find('#data-validation-ch-apply'), el: $window.find('#data-validation-ch-apply'),
labelText: this.textApply labelText: this.textApply,
disabled: true
}); });
// this.chApply.on('change', _.bind(this.onApplyChange, this)); this.chApply.on('change', _.bind(this.onApplyChange, this));
// input message // input message
this.chShowInput = new Common.UI.CheckBox({ this.chShowInput = new Common.UI.CheckBox({
@ -400,6 +401,12 @@ define([ 'text!spreadsheeteditor/main/app/template/DataValidationDialog.templ
} }
}, },
onApplyChange: function(field, newValue, oldValue, eOpts) {
if (this.api && !this._noApply) {
this.api.asc_setDataValidation(this.getSettings(), field.getValue()=='checked');
}
},
_setDefaults: function (props) { _setDefaults: function (props) {
this._noApply = true; this._noApply = true;
if (props) { if (props) {
@ -409,6 +416,7 @@ define([ 'text!spreadsheeteditor/main/app/template/DataValidationDialog.templ
this.chShowDropDown.setValue(!value, true); this.chShowDropDown.setValue(!value, true);
value = props.asc_getType(); value = props.asc_getType();
this.cmbAllow.setValue(value!==null ? value : Asc.c_oAscEDataValidationType.None, true); this.cmbAllow.setValue(value!==null ? value : Asc.c_oAscEDataValidationType.None, true);
this.chApply.setDisabled(value===Asc.c_oAscEDataValidationType.None);
value = props.asc_getOperator(); value = props.asc_getOperator();
this.cmbData.setValue(value!==null ? value : Asc.EDataValidationOperator.Between, true); this.cmbData.setValue(value!==null ? value : Asc.EDataValidationOperator.Between, true);
this.inputRangeMin.setValue(props.asc_getFormula1() ? props.asc_getFormula1().asc_getValue() || '' : ''); this.inputRangeMin.setValue(props.asc_getFormula1() ? props.asc_getFormula1().asc_getValue() || '' : '');
@ -630,7 +638,7 @@ define([ 'text!spreadsheeteditor/main/app/template/DataValidationDialog.templ
textEndTime: 'End Time', textEndTime: 'End Time',
textFormula: 'Formula', textFormula: 'Formula',
textIgnore: 'Ignore blank', textIgnore: 'Ignore blank',
textApply: 'Apply these changes to all othes calls the same settings', textApply: 'Apply these changes to all other cells with the same settings',
textShowDropDown: 'Show drop-down list in cell', textShowDropDown: 'Show drop-down list in cell',
textCellSelected: 'When cell is selected, show this input message', textCellSelected: 'When cell is selected, show this input message',
textTitle: 'Title', textTitle: 'Title',

View file

@ -1552,7 +1552,7 @@
"SSE.Views.DataValidationDialog.strSettings": "Settings", "SSE.Views.DataValidationDialog.strSettings": "Settings",
"SSE.Views.DataValidationDialog.textAlert": "Alert", "SSE.Views.DataValidationDialog.textAlert": "Alert",
"SSE.Views.DataValidationDialog.textAllow": "Allow", "SSE.Views.DataValidationDialog.textAllow": "Allow",
"SSE.Views.DataValidationDialog.textApply": "Apply these changes to all othes calls the same settings", "SSE.Views.DataValidationDialog.textApply": "Apply these changes to all other cells with the same settings",
"SSE.Views.DataValidationDialog.textCellSelected": "When cell is selected, show this input message", "SSE.Views.DataValidationDialog.textCellSelected": "When cell is selected, show this input message",
"SSE.Views.DataValidationDialog.textCompare": "Compare to", "SSE.Views.DataValidationDialog.textCompare": "Compare to",
"SSE.Views.DataValidationDialog.textData": "Data", "SSE.Views.DataValidationDialog.textData": "Data",