问题
In a Kendo UI Dropdown, is it possible to make the drop down panel wider than the control?
回答1:
If the id
of the dropDownList
is drop
, you need to define a CSS style as:
#drop-list {
width: 300px !important;
}
for overwriting KendoUI computed width and set it to (in this example) 300px
.
回答2:
Another possible approach:
var dropdownlist = $("#titles").data("kendoDropDownList");
// set width of the drop-down list
dropdownlist.list.width(400);
Code snippet is taken from the official examples (link).
回答3:
Actually, there's a command for that:
$("#idOfMyDropDownList").data("kendoDropDownList").list.width("auto");
回答4:
Another possible solution:
$("[data-role=dropdownlist]").each(function () {
$(this).data("kendoDropDownList").list.width(300);
});
回答5:
you can set this directly when defining the control with:
.AutoWidth(true)
i.e.
@(Html.Kendo().DropDownList()
.Name("ddl")
.DataTextField("Text")
.DataValueField("Value")
.AutoWidth(true)
.BindTo(Model.list))
来源:https://stackoverflow.com/questions/14128753/kendo-ui-dropdown-making-the-drop-down-panel-wider-than-the-control