Hello,
I'm using Kendo-ui JQuery version, and I'm trying to fill a kendo-ui grid from an ApiController.
My grid remains empty... What am I missing ?
Here is the result of my ApiController : ~/api/Countries :
Here is my ApiController code :
Here is my cshtml code :
Thanks for your help.
I'm using Kendo-ui JQuery version, and I'm trying to fill a kendo-ui grid from an ApiController.
My grid remains empty... What am I missing ?
Here is the result of my ApiController : ~/api/Countries :
[{
"Id"
:4,
"Name"
:
"Germany"
},
{
"Id"
:5,
"Name"
:
"China"
},
{
"Id"
:6,
"Name"
:
"Myanmar"
}]
Here is my ApiController code :
public
class
CountriesController : ApiController
{
private
DBContext db =
new
DBContext();
// GET api/Countries
[Queryable]
public
IQueryable<Country> GetCountries()
{
return
db.Countries;
}
}
Here is my cshtml code :
<script type=
'text/javascript'
>
$(document).ready(
function
() {
$(
"#grid"
).kendoGrid({
columns: [
{ field:
"Id"
, title:
"id"
},
{ field:
"Name"
, title:
"name"
}
],
dataSource:
new
kendo.data.DataSource({
transport: {
read:
"api/Countries"
},
schema: {
model: {
id:
"Id"
,
fields: {
Id: { type:
"number"
},
Name: { type:
"string"
}
}
}
},
pageSize: 3
}),
pageable:
true
});
});
</script>
Thanks for your help.