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();
}