我想为 KendoUi 下拉列表添加一个空白选择项。我遵循与以下链接中提到的相同。
但是,如果我在 document.ready 事件中调用以下内容,
$("#ddl").data("kendoDropDownList").one("open", function() {
$(this.ul[0].firstChild).html(" ");
});
我得到错误“一个”为空或未定义的错误。我已经添加了所需的参考文件。这可能是什么原因造成的?有没有其他方法可以添加空白选择选项?
我在我的 mvc 视图中定义了如下组合框。
<span class="list">
@(Html.Kendo().DropDownList()
.Name("facility").Events(events => events.Change("facilityChange"))
.OptionLabel(" ")
.DataSource(source => source.Read(read => read.Action("_GetFacilitiesForComboBox", "SuccessionInfo")))
.DataTextField("FacilityName")
.DataValueField("FacilityId")
.Value(Model.NextJobFacilityId.ToString())
.HtmlAttributes(new { style = "width:300px" })
)
</span>
请帮忙。