Hi all,
Hope someone can point me in the right direction because this is driving me crazy...
I'm trying to bind a grid to an asp.net WCF service on another domain using jsonp.
The data returned by the WCF service is like localData in the code below. Databinding succeeds when binding the grid to the localData, but if i change to the raDataSource it gives an error. In firebug it says: "invalid label {"d":[etc " .
I found a number of posts on the forum saying to add schema { data: "d" } to the datasource but i keep getting the same error.
Any idea's?
Kind regards,
Tycho
Hope someone can point me in the right direction because this is driving me crazy...
I'm trying to bind a grid to an asp.net WCF service on another domain using jsonp.
The data returned by the WCF service is like localData in the code below. Databinding succeeds when binding the grid to the localData, but if i change to the raDataSource it gives an error. In firebug it says: "invalid label {"d":[etc " .
I found a number of posts on the forum saying to add schema { data: "d" } to the datasource but i keep getting the same error.
var
localData = {
"d"
:[{
"__type"
:
"type1"
,
"ClassNbr"
:
"5"
,
"SiteName"
:
"Name1"
,
"Train"
:
"Train1"
},{
"__type"
:
"type1"
,
"ClassNbr"
:
"4"
,
"SiteName"
:
"Name2"
,
"Train"
:
"Train2"
}]};
var
raDataSource =
new
kendo.data.DataSource({
type:
"odata"
,
transport: {
read: {
type:
"GET"
,
contentType:
"application/json; chartset=utf-8"
,
url: dataUrl,
dataType:
"jsonp"
,
jsonp:
true
,
jsonpCallback:
'callback'
}
},
data: {
siteID: si,
cceMode: mode,
endDate: encodeURIComponent(endDate),
Accept:
"application/json"
},
error:
function
(e) {
alert(
"Error: "
+ e);
},
schema: {
data:
"d"
},
model: {
fields: {
SiteName: { type:
"string"
},
Train: { type:
"string"
}
}
}
});
$(
"#grid"
).kendoGrid({
dataSource: raDataSource ,
height: 360,
columns: [
{ field:
"SiteName"
},
{ field:
"Train"
},
],
dataBound:
function
() { alert(
'bound'
);},
});
Any idea's?
Kind regards,
Tycho