Hi,
I feel like I may be missing something, but like my title says, my grid is not populating with data after the read function. Here is my code:
// grid
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
name
=
"viewport"
content
=
"width=device-width"
/>
<
title
></
title
>
</
head
>
<
body
>
<
div
>
@(Html.Kendo().Grid<
DataManager.Models.CommodityCodesViewModels.IndexViewModel
>()
.Name("commodityCodesGrid")
.Columns(columns =>
{
columns.Bound(c => c.CommodityCodeId).Width(100);
columns.Bound(c => c.CommodityCode).Width(100);
columns.Bound(c => c.Description).Width(100);
})
.HtmlAttributes(new { style = "height: 700px;" })
.Scrollable(s => s.Height(700))
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.Filterable()
.DataSource(dataSource => dataSource
.Custom()
.Batch(true)
.PageSize(20)
.Schema(schema => schema.Model(m => m.Id(p => p.CommodityCodeId)))
.Transport(transport =>
{
transport.Read(read =>
read.Url("http://localhost:51088/api/commoditycodes")
.DataType("jsonp")
);
})
)
)
</
div
>
</
body
>
</
html
>
// View Model
public class IndexViewModel
{
public int CommodityCodeId { get; set; }
[Required, MaxLength(3)]
public string CommodityCode { get; set; }
[Required, MaxLength(50)]
public string Description { get; set; }
}
I have also attached two screenshots. One illustrates the returned data via the corresponding url, and the other shows the response when testing the grid.
Thanks,
Ruben