I can't display in a kendo grid the data that I am returning from my Controller as Json Result.
now from my View I am submitting the information using ajax
an the script with the OnCompleteMethod is below
and the data that I am returning looks like this after I call the controller
What I am doing wrong here?
[HttpPost]
public ActionResult PermitSearch(BptSearchViewModel viewModel)
{
var data = appService.SearchPermitInspection(viewModel);
return Json(data, JsonRequestBehavior.AllowGet);
}
now from my View I am submitting the information using ajax
@
using
(Ajax.BeginForm(
"PermitSearch"
,
"Home"
,
null
,
new
AjaxOptions
{
HttpMethod =
"post"
,
InsertionMode = InsertionMode.InsertAfter,
UpdateTargetId =
"search-results-grid"
,
OnComplete =
"OnCompleteMethod"
}))
{
....
}
<div id=
"search-results-grid"
></div>
an the script with the OnCompleteMethod is below
function
OnCompleteMethod(dataq, status) {
if
(status ===
"success"
) {
$(
"#search-results-grid"
).kendoGrid({
columns: [
{
field:
"jobname"
,
title:
"Job Type"
}
dataSource: {
data: {
"items"
: dataq
},
schema: {
data:
"items"
}
},
groupable:
true
,
sortable:
true
,
pageable: {
refresh:
true
,
pageSizes:
true
,
buttonCount: 5
},
noRecords: {
template:
"No data available on current page. Current page is: #=this.dataSource.page()#"
}
});
}
}
and the data that I am returning looks like this after I call the controller
[
{
"jobname"
:
"job1"
},
{
"jobname"
:
"job2"
}
]
What I am doing wrong here?