JSFiddle - React, Tailwind, and code Playground
by stevescotthome
HTML
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.default.min.css">
<script src="http://cdn.kendostatic.com/2012.1.322/js/kendo.all.min.js"></script>
<h3 data-bind="attr: { class: isSelected }">Foods</h3>
<ol data-bind="source: categories" data-template="category-template">
</ol>
<script id="category-template" type="text/x-kendo-template">
<li data-bind="attr: { class: isSelected }">
<span data-bind="text: categoryName"></span>
<ol data-bind="source: products" data-template="product-template"></ol>
</li>
</script>
<script id="product-template" type="text/x-kendo-template">
<li data-bind="text: productName"></li>
</script>
CSS
.selected{
background: red;
color: white;
}
JavaScript
var viewModel = kendo.observable({
categories: [{
categoryName: "Food",
products: [
{
productName: "Bread"
},
{
productName: "Meat"
}
]
},{
categoryName: "Drinks",
products: [
{
productName: "Beer"
},
{
productName: "Whiskey"
}
]
} ],
isSelected: function(item){
return "selected";
}
});
kendo.bind(document.body, viewModel);