mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-02-10 18:05:32 +08:00
Fix bug 69037
This commit is contained in:
@ -1372,7 +1372,7 @@ define([
|
||||
var type = obj.type,
|
||||
props = obj.pr,
|
||||
specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(),
|
||||
isForm = !!props.get_FormPr(),
|
||||
formProps = props.get_FormPr(),
|
||||
menu = this.listControlMenu,
|
||||
menuContainer = menu ? this.boxSdk.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null,
|
||||
me = this;
|
||||
@ -1409,21 +1409,23 @@ define([
|
||||
});
|
||||
}
|
||||
if (specProps) {
|
||||
if (isForm){ // for dropdown and combobox form control always add placeholder item
|
||||
var text = props.get_PlaceholderText();
|
||||
menu.addItem(new Common.UI.MenuItem({
|
||||
caption : (text.trim()!=='') ? text : this.txtEmpty,
|
||||
value : '',
|
||||
template : _.template([
|
||||
'<a id="<%= id %>" tabindex="-1" type="menuitem" style="<% if (options.value=="") { %> opacity: 0.6 <% } %>">',
|
||||
'<%= Common.Utils.String.htmlEncode(caption) %>',
|
||||
'</a>'
|
||||
].join(''))
|
||||
}));
|
||||
}
|
||||
var count = specProps.get_ItemsCount();
|
||||
if (formProps){
|
||||
if (!formProps.get_Required() || count<1) { // for required or empty dropdown/combobox form control always add placeholder item
|
||||
var text = props.get_PlaceholderText();
|
||||
menu.addItem(new Common.UI.MenuItem({
|
||||
caption : (text.trim()!=='') ? text : this.txtEmpty,
|
||||
value : '',
|
||||
template : _.template([
|
||||
'<a id="<%= id %>" tabindex="-1" type="menuitem" style="<% if (options.value=="") { %> opacity: 0.6 <% } %>">',
|
||||
'<%= Common.Utils.String.htmlEncode(caption) %>',
|
||||
'</a>'
|
||||
].join(''))
|
||||
}));
|
||||
}
|
||||
}
|
||||
for (var i=0; i<count; i++) {
|
||||
(specProps.get_ItemValue(i)!=='' || !isForm) && menu.addItem(new Common.UI.MenuItem({
|
||||
(specProps.get_ItemValue(i)!=='' || !formProps) && menu.addItem(new Common.UI.MenuItem({
|
||||
caption : specProps.get_ItemDisplayText(i),
|
||||
value : specProps.get_ItemValue(i),
|
||||
template : _.template([
|
||||
@ -1433,7 +1435,7 @@ define([
|
||||
].join(''))
|
||||
}));
|
||||
}
|
||||
if (!isForm && menu.items.length<1) {
|
||||
if (!formProps && menu.items.length<1) {
|
||||
menu.addItem(new Common.UI.MenuItem({
|
||||
caption : this.txtEmpty,
|
||||
value : -1
|
||||
|
||||
Reference in New Issue
Block a user