or
var
vm = kendo.viewModel({
animals: []
});
vm.animals.push(
new
Cat());
vm.animals.push(
new
Dog());
kendo.bind(
"#farm"
, vm);
<
div
id
=
"farm"
>
<
div
data-template
=
"animal-template"
data-bind
=
"source: animals"
></
div
>
</
div
>
Here is where I would define the different templates for each animal
var
newDataSource =
new
kendo.data.DataSource({ data: GLOBAL_ALL_PIE_DATA[controlID] });
var
chartConfiguration = {
theme: $(control).attr(
"theme"
),
title: { text: $(control).attr(
"title"
) },
legend: {
position: $(control).attr(
"position"
)
},
seriesDefaults: {
labels: {
visible: $(control).attr(
"showLabels"
),
format:
"{0}%"
}
},
dataSource: newDataSource,
series: [{
type:
"pie"
,
categoryField:
"category"
,
field:
"value"
,
colorField:
"color"
}],
tooltip: {
visible: $(control).attr(
"showTooltip"
),
format:
"{0}%"
}
};
//create the chart
$(jqControlID).kendoChart(chartConfiguration);
}
}
}
var viewModel = kendo.observable({
gridSource: [
// Grid Data
],
cityDataSource: [
// City dropdown data
]
});
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public ADVBrokerList[] GetADVBrokerList()
{
try
{
string jsonData = string.Empty;
objService = new SourceDataServices();
ADVBrokerList[] data = objService.GetADVBrokerList();
return data;
}
finally
{
objService = null;
}
}
var dataSource = new kendo.data.DataSource({
transport: {
read: {
// the remote service url
contentType: "application/json; charset=utf-8",
type: "POST",
dataType: "json"
}
}, // -- END OF TRANSPORT
// describe the result format
schema: {
data: "d"
},
change: function () { // subscribe to the CHANGE event of the data source
$("#main").html(kendo.render(template, this.view()));
}
}); // -- END OF DATASOURCE BLOCK
dataSource.read();