jQGrid is not loading data
Posted
by user324777
on Stack Overflow
See other posts from Stack Overflow
or by user324777
Published on 2010-04-24T05:43:34Z
Indexed on
2010/04/24
5:53 UTC
Read the original article
Hit count: 439
jqgrid
Hi,
I am using jqGrid for my data table solution. Below are the configuration codes.
$(function() {
$("#submitInput").click(function() {
alert("I am called...")
jQuery("#list").jqGrid({
datatype: "json",
url: "http://localhost:1201/admin/someURL.htm",
mtype:"POST",
height: "auto",
colNames:["Column 1", "Column 2", "Column 3", "Column 4", "Column 5"],
colModel:[
{name:"col1", index:"col1", sortable:true, resizable:false},
{name:"col2", index:"col2", sortable:true},
{name:"col3", index:"col3", sortable:false, resizable:false},
{name:"col4", index:"col4", sortable:true, resizable:false},
{name:"col5", index:"col5", sortable:true, resizable:false}
],
sortname:'col1',
sortorder:'asc',
pager: $('#pager'),
rowNum:10,
viewrecords: true,
rowList:[10,20,30],
caption: 'Some Grid Values',
jsonReader: {
root: "responseData",
page: "currentPage",
total: "totalPages",
records: "totalFetchedRecords",
repeatitems: true,
cell: "rowContent",
id: "rowID"
},
gridComplete: function() {
alert("Loading done...");
}
});
});
});
My JSON data is coming in following format:
"currentPage":"1","responseData":[
{"rowContent":["Col1_Val_000001","Col2_Val_1","Col3_Val_1","Col4_Val_1","Col5_Val_1"],"rowID":"Col1_Val_000001"},
{"rowContent":["Col1_Val_000002","Col2_Val_2","Col3_Val_2","Col4_Val_2","Col5_Val_2"],"rowID":"Col1_Val_000002"}
], "totalFetchedRecords":"50","totalPages":"5"}
In my HTML, there is a button with id "submitInput" and a table with id "list".
Somehow, this data is not loaded into the grid.
Please provide some help.
Thanks, Niranjan
© Stack Overflow or respective owner