[英]How to change the model of an ASP .Net MVC Kendo Chart using javascript?
I am using the kendo UI MVC wrapper to create a chart. 我正在使用kendo UI MVC包装器来创建图表。 The chart is using a model:
图表正在使用模型:
@(Html.Kendo().Chart<ModelA>()
....
I wish to change the model used by the chart and reload using a new datasource. 我希望更改图表使用的模型,并使用新的数据源重新加载。 I am changing the datasource in javascript like this:
我正在像这样更改javascript中的数据源:
....
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/Controller/_ChartData",
type: "POST",
data: dataID
}
}
});
This is firing on a button click to reload the data. 这是在单击按钮以重新加载数据时触发的。 The data is reloading correctly.
数据正在正确加载。 Is this the correct way to change the datasource and how do i change the model that the chart is using (ModelA -> ModelB)
这是更改数据源的正确方法吗?如何更改图表使用的模型(ModelA-> ModelB)
Just modify the dataSource... 只需修改dataSource ...
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "/Controller/_ChartData",
type: "POST",
data: dataID
}
}
},
schema: {
model: {
// ModelB details go here
}
});
Have a look at the Kendo documentation . 看看Kendo文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.