I'm evaluating this product for my organization and to be honest I'm very new to this stuff. I've been playing around with stuff for a couple of days but I appear to have become stuck on something pretty trivial.
I'm calling an ASP.NET web service using VS 2010. I'm calling it from the dataSource, and then binding the dataSource to the chart. It works fine when I don't try to pass parameters, I get the results into the chart and everything seems right. The Kendo definition of the datasource is
var dsprov = new kendo.data.DataSource({
schema: {
data: "d"
},
transport: {
read: {
url: "IndustryTrends.aspx/ChartData",
contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
type: "POST"
}
}
});
And the definition of the web service is
<WebMethod()>
Public Shared Function ChartData() As IEnumerable(Of BolIndustryChartDataItem)
Dim c As New List(Of BolIndustryChartDataItem)
c.Add(New BolIndustryChartDataItem("My name", 3,4,5))
Return c
End Function
...this all works fine.
But now I want to add a parameter to the read function in order to be able to read the correct data. I assumed that all I had to do was change the dataSource definition to:
var dsprov = new kendo.data.DataSource({
schema: {
data: "d"
},
transport: {
read: {
url: "IndustryTrends.aspx/ChartData",
contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
type: "POST",
}
}
});
....and then change the web service to
<WebMethod()>
Public Shared Function ChartData(byval name as string) As IEnumerable(Of BolIndustryChartDataItem)
Dim c As New List(Of BolIndustryChartDataItem)
c.Add(New BolIndustryChartDataItem("My name", 3,4,5))
Return c
End Function
....but this causes the web service to never get called. I know I missing something trivial here but I'e spend some time looking at it, tried a bunch of different things, and I can't figure out what.
Thanks!
I'm calling an ASP.NET web service using VS 2010. I'm calling it from the dataSource, and then binding the dataSource to the chart. It works fine when I don't try to pass parameters, I get the results into the chart and everything seems right. The Kendo definition of the datasource is
var dsprov = new kendo.data.DataSource({
schema: {
data: "d"
},
transport: {
read: {
url: "IndustryTrends.aspx/ChartData",
contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
type: "POST"
}
}
});
And the definition of the web service is
<WebMethod()>
Public Shared Function ChartData() As IEnumerable(Of BolIndustryChartDataItem)
Dim c As New List(Of BolIndustryChartDataItem)
c.Add(New BolIndustryChartDataItem("My name", 3,4,5))
Return c
End Function
...this all works fine.
But now I want to add a parameter to the read function in order to be able to read the correct data. I assumed that all I had to do was change the dataSource definition to:
var dsprov = new kendo.data.DataSource({
schema: {
data: "d"
},
transport: {
read: {
url: "IndustryTrends.aspx/ChartData",
contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
type: "POST",
data: { | |
name: function() { | |
return "michael"; | |
} | } |
}
});
....and then change the web service to
<WebMethod()>
Public Shared Function ChartData(byval name as string) As IEnumerable(Of BolIndustryChartDataItem)
Dim c As New List(Of BolIndustryChartDataItem)
c.Add(New BolIndustryChartDataItem("My name", 3,4,5))
Return c
End Function
....but this causes the web service to never get called. I know I missing something trivial here but I'e spend some time looking at it, tried a bunch of different things, and I can't figure out what.
Thanks!