[DE] Control settings: use sdk functions

This commit is contained in:
Julia Radzhabova 2019-11-08 12:20:31 +03:00
parent 322ecad082
commit 4d68323d3f

View file

@ -295,33 +295,47 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
this.chLockDelete.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.SdtLocked); this.chLockDelete.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.SdtLocked);
this.chLockEdit.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.ContentLocked); this.chLockEdit.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.ContentLocked);
var type = props.get_SpecificType();
//for list controls //for list controls
/* this.btnsCategory[2].setVisible(type == Asc.c_oAscContentControlSpecificType.ComboBox || type == Asc.c_oAscContentControlSpecificType.DropDownList);
// this.btnsCategory[2].setVisible(type == 'list'); if (type == Asc.c_oAscContentControlSpecificType.ComboBox || type == Asc.c_oAscContentControlSpecificType.DropDownList) {
var specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr();
var items = props.get_ListItems(); if (specProps) {
if (items) { var count = specProps.get_ItemsCount();
var arr = []; var arr = [];
for (var i=0; i<items.length; i++) { for (var i=0; i<count; i++) {
arr.push({ arr.push({
value: items[i].get_Value(), value: specProps.get_ItemValue(i),
name: items[i].get_Name() name: specProps.get_ItemDisplayText(i)
}); });
}
this.list.store.reset(arr);
} }
this.disableListButtons();
this.list.store.reset(arr);
} }
*/
this.disableListButtons();
//for date picker //for date picker
// this.btnsCategory[3].setVisible(type == 'date'); this.btnsCategory[3].setVisible(type == Asc.c_oAscContentControlSpecificType.DateTime);
if (this.options.lang) { if (type == Asc.c_oAscContentControlSpecificType.DateTime) {
var item = this.cmbLang.store.findWhere({value: this.options.lang}); var specProps = props.get_DateTimePr();
item = item ? item.get('value') : 0x0409; if (specProps) {
this.cmbLang.setValue(item) var lang = specProps.get_LangId() || this.options.lang;
if (lang) {
var item = this.cmbLang.store.findWhere({value: lang});
item = item ? item.get('value') : 0x0409;
this.cmbLang.setValue(item);
}
this.updateFormats(this.cmbLang.getValue());
// var rec = this.listFormats.store.find({format: specProps.get_DateFormat()});
// if (rec) {
// this.listFormats.selectRecord(rec);
// this.listFormats.scrollToRecord(rec);
// }
}
} }
this.updateFormats(this.cmbLang.getValue());
this.type = type;
} }
}, },
@ -349,11 +363,13 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
props.put_Lock(lock); props.put_Lock(lock);
// for list controls // for list controls
// var arr = []; if (this.type == Asc.c_oAscContentControlSpecificType.ComboBox || this.type == Asc.c_oAscContentControlSpecificType.DropDownList) {
// this.list.store.each(function (item, index) { var specProps = new AscCommon.CSdtComboBoxPr();
// arr.push(new Asc.asc_CListItem(item.get('name'), item.get('value'))); this.list.store.each(function (item, index) {
// }, this); specProps.add_Item(item.get('name'), item.get('value'));
// props.set_ListItems(arr); });
(this.type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.put_ComboBoxPr(specProps) : props.put_DropDownListPr(specProps);
}
//for date picker //for date picker
// var rec = this.listFormats.getSelectedRec(); // var rec = this.listFormats.getSelectedRec();