kendo ui treeview 中是否存在 hack,因此当用户单击根节点时,它将触发 select 方法,与其他分支节点一样。
目前,我找不到针对此行为的选项,并且 select 方法仅针对分支触发。
var areaDropDownTreeView = $(tvElement).kendoExtDropDownTreeView({
treeview: {
template: kendo.template($(tvTemplate).html()),
dataSource: dataSource
}
}).data("kendoExtDropDownTreeView");
var $dropdownRootElem = $(areaDropDownTreeView.dropDownList().element).closest("span.k-dropdown");
var $treeviewRootElem = $(areaDropDownTreeView.treeview().element).closest("div.k-treeview");
// Unbind default select event.
areaDropDownTreeView.treeview().unbind("select");
// Bind new select event.
areaDropDownTreeView.treeview().bind("select", function (e) {
// want to do something here for every node including the root, but the root is not triggering select, only the branches are
});