I want to set the tree view color based on the value defined in the datasource field,
From this link, I think that what I am trying to do is possible, but I am not using MVVM, so in my case what I am missing below? any idea??
http://www.telerik.com/forums/mvvm---treeview-only-updates-on-datatextfield-change
<div id="treeview"></div>
$("#treeview").kendoTreeView({
template: "#= item.text # color:#: item.color #",
dataSource: [
{ text: "green", color: "green", items: [
{ text: "yellow", color: "yellow" },
{ text: "red", color: "red" }
]},{
text: "blue", color: "blue"
}
]
});
Fiddle link, http://jsfiddle.net/KendoDev/qZeK6/
Define the template as:
As far as the
color
is valid color name it should work.Your JSFiddle modified here: http://jsfiddle.net/OnaBai/qZeK6/3/