Here is the Javascript code:
<script type="text/javascript">
$(function () {
$("#list").jqGrid({
url: "/Movies/GetAllMovies",
datatype: "json",
mtype: "GET",
colNames: ["Id", "Title", "Director", "Date"],
colModel: [
{ name: 'Id', index: 'Id', sorttype: "int" },
{ name: 'Title', index: 'Title', sortable: false },
{ name: 'Director', index: 'Director', sortable: false },
{ name: 'ReleaseDate', index: 'ReleaseDate', align: "right", sortable: false }
],
viewrecords: true,
pager: "#pager",
rowNum: 5,
rownumbers: true,
rowList: [5, 10, 15],
height: 'auto',
width: '500',
caption: "My first grid",
});
});
</script>
and the method which return the list of data is
[HttpGet]
public JsonResult GetAllMovies()
{
var jsonObj = Json(movieAccessLayer.GetAllMovies());
return Json(jsonObj, JsonRequestBehavior.AllowGet);
}
response string:
[{"Id":66,"Title":"BibUtt","Director":"Amal Neeradh","ReleaseDate":"2006-12-12T00:00:00"},{"Id":67,"Title":"Rojaa","Director":"ManiRathnam","ReleaseDate":"1992-05-11T00:00:00"},{"Id":71,"Title":"dwed","Director":"ece","ReleaseDate":"2012-12-12T00:00:00"},{"Id":72,"Title":"Test","Director":"qqwqww","ReleaseDate":"2015-02-09T00:00:00"}]
But the problem is: JQgrid and the header row is displaying but the remaining rows are not showing. The controller method is also correct and it will return a list of object.
Please help me.