Untitled
user_8454105
javascript
2 years ago
1.2 kB
7
Indexable
function dropDownEditorFromDataSource(container, textField, valueField, selectedValueField, dataSource, onSelectCallbackFunction, sortByProperties, selectedValue, autoBind, areOptionsFullWidth, onChangeCallbackFunction, headerTemplateField, onOpenCallbackFunction, forceOpen, dropDownSourceForId, forceRefresh) {
// ... existing code ...
var dropdown = $("<input id=\"" + dropDownSourceForId + "\" data-text-field=\"" + textField + "\" data-value-field=\"" + valueField + "\" data-bind=\"value:" + selectedValueField + "\"/>")
.appendTo(container)
.kendoDropDownList({
// ... existing configuration ...
});
// ... existing code ...
// Function to handle click outside
function handleClickOutside(event) {
if (!$(event.target).closest('#' + dropDownSourceForId).length) {
dropdown.data("kendoDropDownList").close();
document.removeEventListener('click', handleClickOutside);
}
}
// Open event handler
dropdown.data("kendoDropDownList").bind("open", function() {
setTimeout(function() {
document.addEventListener('click', handleClickOutside);
}, 0);
});
}Editor is loading...