or
var arr = ["one", "two", "three"];var datasource = new kendo.data.DataSource({ data: arr});datasource.read();var data1 = datasource.data();for (var i = 0; i < data1.length; i++) { alert(data1[i]);}datasource.add("four");var data2 = datasource.data();for (var i = 0; i < data2.length; i++) { alert(data2[i]);}jQuery182041788989288830735_1364362919255([{"id":"6a488457-5b85-48fc-be24-b469219564c4","sprite":"custom3","text":"Silk","hasChildren":true,"data" :{"nodetype":"Fabric" ,"level":3 ,"activity":0 ,"maintenance":NaN ,"status":3 }},{"id":"8a9e479a-4448-462e-9151-b1913cc1660e","sprite":"custom3","text":"Wool","hasChildren":true,"data" :{"nodetype":"Fabric" ,"level":3 ,"activity":0 ,"maintenance":NaN ,"status":3 } },{"id":"da373cd1-4264-4096-9955-5527e6c49dd9","sprite":"custom3","text":"Canvas","hasChildren":true,"data" :{"nodetype":"Fabric" ,"level":3 ,"activity":0 ,"maintenance":NaN ,"status":4 }}])window.reportUrl = '/reporter';window.statusCode = [ 'bla', 'bla', 'bla' ];template:"<span class='name'>#: item.text #</span>"+ "# if (item.data.level == 3) {#" + "# if (item.hasChildren) {#" + " | <a href='#= window.reportURL #?id=#= item.id #' title='View Report' target='_blank'>" + "<img alt='View Report' class='cm-icon' src='/images/report.png'>" + "</a>" + "#}#" + "# if (('status' in item.data) && !isNaN(item.data.status)) {#" + " | <span class='cs-status'>Status: #= window.statusCode[item.data.status] #</span>" + "#}#"+ "#}#"$.getJSON ( .... ).done (function (info) { // info looks like {result:{id:<some-id>,status:<some-status>}} var tv = $('#treeview').data('kendoTreeView'); var dsData = tv.dataSource.get(info.result.id); dsData.data.set('status', info.result.status); // does not cause node to be redrawn dsData.set('data.status', info.result.status); // does not cause node to be redrawn dsData.set('text', 'BLA BLA BLA'); // DOES cause node to be redrawn});@(Html.Kendo().Chart(Model) .Name("Regions") .Title("Regions") .DataSource(ds => { ds.Read(read => read.Action("GetClientRecordsCountByRegion", "Home")); ds.Sort(sort => sort.Add(model => model.Region).Ascending()); } ) .Series(series => { series.Pie("TrademarkCount", "Region") .Labels(lbl => lbl.Visible(true).Template("#= category #: #= value #") .Align(ChartPieLabelsAlign.Circle) .Position(ChartPieLabelsPosition.OutsideEnd)); }))function refreshsource() { var dataSource = new kendo.data.DataSource({ transport: { read: { type: "GET", url: "/Home/GetClientRecordsCountByRegionNew", dataType: "json" } } }); var chart = $("#Regions").data("kendoChart"); chart.setDataSource(dataSource); chart.redraw(); }I am using the Grid with remote data, but client side paging/filtering/sorting. The data source is pre-filtered, and setup as follows:
var dataSource = new kendo.data.DataSource({ error: function (e) { alert(e.errors); }, filter: { field: "CreatorADGuid", operator: "eq", value: '@ViewBag.UserId' }, pageSize: 40, batch: true, transport: { read: { url: "/api/project/", dataType: "json" }, update: { url: "/api/project/", type: "POST", dataType: "json" }, create: { url: "/api/project/", type: "PUT", dataType: "json" } }, schema: { data: "Body", total: function (response) { return response.Body.length; }, model: { id: "Id", fields: { Id: { type: "string", defaultValue: Constants.emptyGUID }, Title: { type: "string", validation: { required: true }, editable: true }, ScheduAllId: { type: "string", editable: true }, CreatorDisplayName: { type: "string", editable: false }, CurrentStatusDate: { type: "string", defaultValue: '@DateTime.Now.ToShortDateString()', editable: false } } }, errors: "MessageDetails" } });$("#project-grid").kendoGrid({ dataSource: dataSource, toolbar: kendo.template($("#project-toolbar-template").html()), pageable: true, height: $('body').height(), sortable: { mode: "multiple", allowUnsort: true }, filterable: true, columns: [ { field: "Title", title: "Title", template: kendo.template($("#project-title-template").html()) }, { field: "ScheduAllId", title: "ScheduAllId", width: "20%" }, { field: "CreatorADGuid", title: "Creator", template : '#= CreatorDisplayName #', width: "20%" }, { field: "CurrentStatusDate", title: "Created Date", width: "20%", format: "{0:dd/MM/yy}" }, { command: ["edit"], title: " ", }], editable: { mode: 'popup', template: kendo.template($("#project-edit-template").html()), }, edit: function (e) { var editWindow = e.container.data("kendoWindow"); if (e.model.isNew()) { e.container.data("kendoWindow").title('Add New Project'); } else { e.container.data("kendoWindow").title('Edit Project'); } } });