Kendo UI Dropdown, making the drop down panel wider than the control

你说的曾经没有我的故事 提交于 2019-12-23 11:59:24

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!