1 substring kendo-ui drop-down-menu
我使用Kendo UI Web DropDownList http://demos.telerik.com/kendo-ui/web/dropdownlist/index.html
(http://docs.telerik.com/kendo-ui/getting-started/web/dropdownlist/overview中的文档)
当文本太长时,DropDownList会自动为该项设置换行符,此项可能为3行.但是,我想要每行一个项目.如何为长文本修剪或显示标题(在末尾包含"..").
尝试定义以下CSS:
li.k-item {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Run Code Online (Sandbox Code Playgroud)
您可以通过执行以下操作将其限制为仅一个元素:
var dd = $("#list2").kendoDropDownList({
dataSource: titles
}).data("kendoDropDownList");
dd.list.addClass("ob-ellipsis");
Run Code Online (Sandbox Code Playgroud)
和CSS一样
.ob-ellipsis li.k-item {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
Run Code Online (Sandbox Code Playgroud)
示例:http://jsfiddle.net/OnaBai/Yupwj/