Hi
I am trying to make a basic datasource integration and populate a grid with data.
My RST service delivers JSON in this format
This is how I try to setup the datasource and Grid:
I can see the GET request being carried out in FireBug, but the Grid remains empty.
Any suggestions?
I have one further question:
Is it possible to omit the data parameter, and leave out the "root" element?
I would like to be able to read json like this:
/Thomas
I am trying to make a basic datasource integration and populate a grid with data.
My RST service delivers JSON in this format
{
"country"
:[
{
"codeLong"
:
"AUT"
,
"codeShort"
:
"AT"
,
"name"
:
"Austria"
},
{
"codeLong"
:
"BEL"
,
"codeShort"
:
"BE"
,
"name"
:
"Belgium"
},
{
"codeLong"
:
"BGR"
,
"codeShort"
:
"BG"
,
"name"
:
"Bulgaria"
}
]}
This is how I try to setup the datasource and Grid:
var
ds =
new
kendo.data.DataSource({
transport: {
read: {
url:
"http://localhost:10040/.functions.portlets/services-rest/countriesservice/countriesuk"
,
dataType:
"json"
}
},
schema: {
data:
"country"
,
model: {
fields: {
codeLong: { type:
"string"
},
codeShort: { type:
"string"
},
name: { type:
"string"
}
}
}
}
});
$(
"#grid"
).kendoGrid({
dataSource: ds,
height: 280,
scrollable: {
virtual:
true
},
columns: [
{ field:
"codeLong"
, title:
"codeLong"
},
{ field:
"codeShort"
, title:
"codeShort"
},
{ field:
"name"
, title:
"name"
},
]
});
});
I can see the GET request being carried out in FireBug, but the Grid remains empty.
Any suggestions?
I have one further question:
Is it possible to omit the data parameter, and leave out the "root" element?
I would like to be able to read json like this:
[{
"codeLong"
:
"AUT"
,
"codeShort"
:
"AT"
,
"name"
:
"Austria"
},
{
"codeLong"
:
"BEL"
,
"codeShort"
:
"BE"
,
"name"
:
"Belgium"
},
{
"codeLong"
:
"BGR"
,
"codeShort"
:
"BG"
,
"name"
:
"Bulgaria"
}]
/Thomas