假设我想在动态加载的Kendo UI TreeView中为与特定文本匹配的所有树节点添加红色背景。我怎么能这样做?
customize node styles when instantiating trees from HTML很容易,但对于树loaded from a local data source或read from a remote HierarchicalDataSource,似乎没有办法改变项目的文字 per -node 样式:
如何在从JavaScript加载树时实现类似的功能?
答案 0 :(得分:3)
为什么你不只是使用jQuery。像这样:
$("#treeview").kendoTreeView({
...
dataBound: function (e) {
var text = "Your Text";
e.sender.element.find("span.k-in:contains(" + text + ")").css('background-color', 'red');
}
});