or
var Model = kendo.data.Model.define({ id: "Id", fields: { Id: { type: "string", }, Name: { type: "string", }, Tags: [] }, mapping: { Tags: { children: function (data) { return $.extend(data, { onRemove: function (e) { console.log(e); } }); } } }});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;}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]); } }}var viewModel = new Model({ Id: null, Name: null, Tags: []});var dataSource = new kendo.data.dataSource({ transport: { read: { url: '/data/items/', dataType: "json", type: 'GET' } }, schema: { total: "total", data: "data" }});Id: "items/1",Name: "Some Game Item",Tags: [ { Id: "tags/1", Name: "Sword" }, { Id: "tags/2", Name: "Weapon" }]viewModel.fromJSON(data.toJSON(), viewModel.mapping);filter: "tbody > tr"var dataSource = new kendo.data.DataSource({ type: "json", transport: { read: function(options) { db.transaction(queryRows, app.dbError); function queryRows(tx) { tx.executeSql("SELECT comps.*, (SELECT COUNT(*) FROM comps WHERE comps.comp_name LIKE ?) as total FROM comps WHERE comps.comp_name LIKE ? LIMIT ?, ?", ["%" + $("#search-comp-name").val() + "%", "%" + $("#search-comp-name").val() + "%", (options.data.page - 1) * 20, 20], queryRowsSuccess, queryRowsFailure); } function queryRowsSuccess(tx, results) { var res = Array(); var total = 0; for(var i = 0; i < results.rows.length; i++) { res.push(results.rows.item(i)); } if(results.rows.length > 0) total = results.rows.item(0).total; var resSchema = { results: res, total: total }; options.success(resSchema); } function queryRowsFailure(err) { app.compListDbError(); } } }, schema: { total: function (response) { return response.total; }, data: function(response) { return response.results; }, }, serverPaging: true, pageSize: 20 }); $("#companyResultList").kendoMobileListView({ dataSource: dataSource, template: $("#endless-scrolling-template").text(), endlessScroll: true });<div data-role="layout" data-id="default"> <header data-role="header"> <div data-role="navbar"> some content ... </div> </header> <footer data-role="footer"> <div data-role="tabstrip"> some content... </div> </footer></div><div data-role="layout" data-id="layout2"> <header data-role="header"> <div data-role="navbar"> some other content ... </div> </header> <footer data-role="footer"> <div data-role="tabstrip"> some other content... </div> </footer> </footer></div><div id="view1" data-role="view" data-layout="default"> content...</div><div id="view2" data-role="view" data-layout="layout2"> content...</div>