Kendo custom style treeview node text in trees loaded from JavaScript
Suppose I want to add a red background to all tree nodes corresponding to specific text in a dynamically loaded TreeView for Kendo UI. How can i do this?
It's easy to customize node styles when instantiating trees from HTML , but for trees loaded from local data source or read from remote Hierarchical data source , there seems to be no way to change the text of a node style element:
- the template parameter applies to all nodes in the tree
- spriteCssClass only applies to the icon node
How can I achieve something like this when loading a tree from JavaScript?
+3
source to share
1 answer
Why don't you just use jQuery for it. Like this:
$("#treeview").kendoTreeView({
...
dataBound: function (e) {
var text = "Your Text";
e.sender.element.find("span.k-in:contains(" + text + ")").css('background-color', 'red');
}
});
Working example: http://dojo.telerik.com/oxUKI
+3
source to share