I'm hoping to use jqGrid for a current web project that I'm working on. The problem is, I can't seem to get the JSON data to be displayed by the grid. Here is the grid's initialization code:
$.fn.loadjqgrid = function(httpposturl){
$(this).jqGrid({
url: httpposturl,
datatype: "json",
mtype: "GET",
colNames: ["Video Title", "Description", "Date Taken", "Date Uploaded"],
colModel: [
{name:"videoTitle", index:"videoTitle", width:150},
{name:"videoDescription", index:"videoDescription", width:200},
{name:"dateTaken", index:"dateTaken", width:150, sortable:true},
{name:"dateUploaded", index:"dateUploaded", width:150, sortable:true}
],
pager: "#gridpager",
rowNum: 10,
viewrecords: true,
caption: "Video Grid"
});
};
The JSON that's returned by the Java servlet:
[{"dateTaken":"Wed Feb 16 00:00:00 UTC 2011","videoDescription":"This is a test","videoTitle":"Test Video","dateUploaded":""}]
Is there something wrong with how the JSON has been formatted or the way the grid has been initialized? Thanks for the help!