or
var carriers = $("#carrierList").kendoListView({ selectable: true, pageable : true , change: onChange, dataBound : onDataBound , dataSource: t94StragglerCarriers, template : kendo.template($("#carrierTemplate").html()) }).data("kendoListView");function onChange() { var listView = $("#carrierList").data("kendoListView"); var index = listView.select().index(); var item = listView.dataSource.view()[index]; console.log("Item " + index + " selected. Text = " + item.val); }var Model = kendo.data.Model.define({ Id: "Id", fields: { Id: { type: "string", }, Name: { type: "string", }, Mutations: [], Tags: [] }, mapping: { Tags: { children: function (data) { return $.extend(data, { onRemove: function (e) { // execute code } }); } }, Mutations: { children: function (data) { return $.extend(data, { Label: null, onRemove: function (e) { // execute code }, onEdit: function (e) { // execute code }, onSave: function (e) { // execute code } }); } } }});kendo.data.ObservableObject.prototype.fromJSON = function (source, mapping) { var name, value, observable = this; // if there is mapping given, then pass it through that first if (mapping) { source = kendo.mapping(source, mapping); } for (name in source) { if (observable.hasOwnProperty(name)) { observable.set(name, source[name]); } }}kendo.mapping = function (source, mapping) { var name, value; // if the user provides us a mapping, we can use that to help // build the objects appropriately for (name in source) { if (source.hasOwnProperty(name)) { // get the value for this property or item value = source[name]; // try to determine if this is an array, or just a // normal object. That will greatly dictate our choice of behavior if (value instanceof Array) { // if this is an array, then we will try to check for a // key in the mapping schema if (mapping[name].children) { // if we discover a mapping key for this array, we // will use it to reconstruct the array data for (var i = 0; i < value.length; i++) { source[name][i] = mapping[name].children(value[i]); } } } else { // attempt to match any non array type keys if (mapping[name]) { source[name] = mapping[name](value); } } } } return source;}// -------------------------------------------------------------// create a kendo ui grid to show the existing prototypes// -------------------------------------------------------------widgets.grid = $('#grid').kendoGrid({ dataSource: { transport: { read: { url: "/administrator/data/prototypes", dataType: "json", type: 'GET' } }, schema: { total: "total", data: "data" }, page: 0, pageSize: 15, take: 15, serverPaging: true, serverFiltering: true, type: "aspnetmvc-ajax" }, pageable: { refresh: true, pageSizes: true }, selectable: "row", columns: [ { field: "Id", width: 25, title: "Identity" }, { field: "Name", width: 40, title: "Name" } ], change: function (e) { // get the selected row from the grid var selected = this.select(); // get the data from the selected row var data = this.dataItem(selected); // update the model viewModel.fromJSON(data.toJSON(), viewModel.mapping); },}).data("kendoGrid");viewModel.Mutations.bind("change", function (e) { // do something else});-- This represents my entity and view model, both the fields are the same but have slightly different names
public class Car { public string Name { get; set; }}public class CarViewModel { public string CarName { get; set; }}var theTree = $("#treeview").kendoTreeView({ dataSource: folderArray, template: $("#foldersTemplate").html(), expand: function(e) { code for grabbing any sub-folders. }, select : function(e) { var treeviewInner = e.sender, idFolder = treeviewInner.dataItem(e.node).id; /* set-up angularjs controller scope */ window.location.href = "#/folder/" + idFolder; //navigates to the proper folder gridview when node seleced. }});