I'm trialling at the moment but i'm having a problem with the grid control.
I get the intial grid up with data to begin with but when i try to page or sort etc internet explorers asks whether I want to download the response and Firefox just displays the raw json data in a page.
I was wondering if anyone knew where I was going wrong with this one?
Here's the code:
private
IEnumerable<ReqAssess> GetRequests()
{
var reqassess = reqAssessService.GetReqAssess();
return reqassess;
}
public
ActionResult Products_Read([DataSourceRequest] DataSourceRequest request)
{
return Json(GetRequests().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
@(Html.Kendo().Grid(Model)
.Name(
"Grid")
.Columns(columns =>
{
columns.Bound(p => p.ReqId).Width(100).Groupable(
false).Title("Request ID").ClientTemplate(
"# if (Urgent == \"Y\") { #" +
"<div style=\"background-color: Red;\">#: ReqId #</div>" +
"# } else { #" +
"#: ReqId #" +
"# } #"
);
columns.Bound(p => p.CompId).Title(
"Company ID").Width(110);
columns.Bound(p => p.Facid).Title("Facility ID").Width(110);
columns.Bound(p => p.Mtrlcode).Title("Code").Width(90);
columns.Bound(p => p.Tradename).Title("Tradename").Width(170);
columns.Bound(p => p.Requested).Format("{0:dd/MM/yyyy:hh:mm:ss}").Width(110); ;
columns.Bound(p => p.DateDue).Format("{0:dd/MM/yyyy}").Title("Date due").Width(100); ;
columns.Bound(p => p.Completed).Format("{0:dd/MM/yyyy}").Title("Completed").Width(100); ;
columns.Bound(p => p.Status).Width(150);
columns.Bound(p => p.AssignedTo).Width(100);
})
.ClientDetailTemplateId(
"employeesTemplate")
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Selectable()
.Pageable(pager => pager
.Refresh(
true)
.PageSizes(new int[4] {10, 20, 30, 40}))
.ColumnMenu()
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"Products_Read", "InTray"))
.PageSize(30)
))