我正在使用 Kendo UI DropDownList 但找不到在其中对值进行分组的方法。这个功能可用吗?
从 2013 年初看到以下帖子说这在路线图上,但不确定它是否已实施。
http://www.telerik.com/forums/option-group-for-datasource-in-dropdownlist
我正在使用 Kendo UI DropDownList 但找不到在其中对值进行分组的方法。这个功能可用吗?
从 2013 年初看到以下帖子说这在路线图上,但不确定它是否已实施。
http://www.telerik.com/forums/option-group-for-datasource-in-dropdownlist
现在实际上支持分组,连同数据源。这是一个代码片段,它将使用 Kendo UI 2015.3.1111 和 jQuery 1.9.1 创建一个下拉列表,按团队颜色分组。数据源candidates
是数据项的本地数组。下拉列表将替换页面上的 HTML 元素,<input id="victim"/>
.
var candidates = [
{ "id": 1, "name": "Alice", "team": "Red" },
{ "id": 2, "name": "Bob", "team": "Red" },
{ "id": 3, "name": "Charlie", "team": "Blue" },
{ "id": 4, "name": "Dorothy", "team": "Blue" },
{ "id": 5, "name": "Ed", "team": "Green" },
{ "id": 6, "name": "Frances", "team": "Green" },
{ "id": 7, "name": "George", "team": "Purple" },
{ "id": 8, "name": "Helen", "team": "Purple" },
];
$("#victim").kendoDropDownList({
"dataTextField": "name",
"dataValueField": "id",
"dataSource": { "data": candidates, "group": "team" },
"index": 0
});
我以前没有注意到,但小部件也会对组进行排序。
Kendo DropDownList 小部件不支持分组。