or
var window = $("#window");
window.kendoWindow({ width: "505px", height: "315px", title: "Mail", actions: ["Refresh", "Maximize", "Close"], content:"inbox/getemail.aspx?msgid="+msgid, iframe:false }); window.data("kendoWindow").open();script language="javascript">var messageData;$.fn.getMessageData = function(){ messageData = { time:'2012-07-26 12:34:50', sender:'test@test.com', subject:'Testing message data' };};$(function(){ var template = kendo.template($("#template").html()); $.fn.getMessageData(); $("#preview").html(template(messageData)); });</script><script type="text/x-kendo-template" id="template"> <h3>#= subject #</h3> <h4>posted on #= time # by <strong>#= sender #</strong></h4> </script> <div id="preview"></div>[{ id:'2022', text:'Folder1', items: [{ id:'3202', text:'Sub-Folder1' }, { id:'1234', text:'Sub-Folder2', moo: true }]}]var liElement = $('#treeView').data('kendoTreeView').search({id:'3202'});var liElement = $('#treeView').data('kendoTreeView').search({id:'1234', moo: true});$("#scenegraph-treeview").data('kendoTreeView').search = function (json, source) { if (json !== undefined) { var data = source || this.dataSource, child, item, i, k, match, allMatched; // If the data has the properties we need if (data && data._data) { child = data._data; // If the array has items if (child.length) { // Loop the array items for (i = 0; i < child.length; i++) { item = child[i]; console.log('Checking child ' + i + ' id ' + item.id); // Check each json property against the current item's properties // and if they all match, grab the tree item based on it's UID allMatched = true; for (k in json) { if (json.hasOwnProperty(k)) { if (item[k] !== json[k]) { // The item doesn't have all the properties // that the json object does allMatched = false; break; } } } if (allMatched) { // We've found a match, grab the tree item from the UID and return it return this.findByUid(item.uid); } else { // We didn't find what we were looking for so search the children if (item.children) { match = this.search(json, item.children); if (match) { return match; } } } } } } }};