My jqGrid is displayed but it does’nt show the data I checked the json source and it is ok
$(document).ready(function () {
$("#grid").jqGrid(
{
url: 'GetDepartment',
datatype: 'json',
mtype: 'GET',
colNames: ['Department ID', 'Department Name'],
colModel: [
{ name: 'DepartmentID', index: 'DepartmentID' },
{ name: 'DepartmentName', index: 'DepartmentName'}
],
pager: $("#GridPager"),
rowNum: 2,
rowList: [5, 10, 15, 20],
width: 'auto',
sortname: 'DepartmentID',
sortorder: "ASC"
})
$("#grid").jqGrid('navGrid', '#GridPager', { add: false, edit: false, del: false, search: false})
})
I think you are missing jsonReader, add the below code to your grid
Take a look at the wiki for json format expected
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data#json_data
so in your case the json response should be