【发布时间】:2021-01-08 12:30:07
【问题描述】:
我正在尝试过滤下拉列表并使用 nodatatemplate 从下拉列表中添加项目。问题是当我单击下拉列表时它的显示值并快速关闭,所以我无法单击添加为新项目按钮。请看截图。窗户来了又快关了。 HTML
<div class="col-6">
<label class="ez-label-bold">Project Name</label>
<input type="text" id="Job_Splitprojectname" class="ez-select w-100">
</div>
$("#Job_Splitprojectname").kendoDropDownList({
filter: "startswith",
dataSource: projectDS,
dataTextField: "ProjectName",
dataValueField: "ProjectID",
optionLabel: "Select Project",
noDataTemplate: $("#noDataTemplate").html()
});
无数据模板:
<script id="noDataTemplate" type="text/x-kendo-tmpl">
<div>
No Project Found. Do you want add as new Project - '#: instance.filterInput.val() #' ?
</div>
<br />
<button class="k-button" onclick="addNew('#: instance.element[0].id #', '#: instance.filterInput.val() #')">Add as new Project</button>
</script>
What is the reason that dropdown automatically closing while click on dropdown? 在一毫秒内完成列表的到来和关闭。问题在这一行 filter: "startswith", 。如果我删除此行,则下拉菜单不会自动关闭。谢谢!
【问题讨论】:
标签: jquery asp.net-mvc filter kendo-ui