kendo treeview datasource json code example
Example 1: kendo datasource get
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "https://demos.telerik.com/kendo-ui/service/products",
dataType: "jsonp" // "jsonp" is required for cross-domain requests; use "json" for same-domain requests
}
}
});
dataSource.fetch(function(){
var data = dataSource.data();
console.log(data.length); // displays "77"
console.log(data[0].ProductName); // displays "Chai"
});
Example 2: kendo treeview template
<button type="button"
onclick="
Open('#template', {
'item': {
'name': 'Pop up window'
}
})" >
Open
</button>
<script type="text/x-kendo-template" id="template" data-title="template">
<span class="label">
You opened the template '${ item.name }'.<br />
Are you sure you want to continue?
</span>
<div class="manualDialogButtons">
<button type="button" class="k-button k-primary"
onclick="DoSomething(); Kendo.Dialog.Close(this)">
Close
</button>
</div>
</script>
<script>
function DoSomething() { alert("template was closed"); }
function Open(popup, item) {
var dlg = Kendo.Dialog.FromTemplate($(popup), item, { minWidth: 500 });
dlg.open();
}
</script>