Forum
13:29
20/04/2010
Not sure where to put this, but this room seem the best to me. 😀
Anyway I got this "g.headers[c] is undefined" error when I try to load json data into jqgrid.
I am using jqgrid 3.6.4 on jquery 1.3.2. My jqgrid setting is like this :
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'getCountiresIso',
datatype: 'json',
mtype: 'GET',
colNames:['ISO','Name', 'Printable Name','ISO3','Numeric Code'],
colModel :[ {name:'iso', index:'iso', width:55},
{name:'name', index:'name', width:90},
{name:'printable_name', index:'printable_name', width:150, align:'right'},
{name:'iso3', index:'iso3', width:80, align:'right'},
{name:'numcode', index:'numcode', widthwidth:80, align:'right'}],
pager: jQuery('#pager'),
rowNum:10,
rowList:[10,20,30],
sortname: 'id',
sortorder: "desc",
viewrecords: true,
imgpath: 'themes/basic/images',
caption: 'My first grid' });
});
jQuery("#list").jqGrid('navGrid','#pager',{edit:false,add:false,del:false});
surely I have these
<table id="list" class="scroll"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
The json is
{"page":"1","total":24,"records":239,"rows":[{"id":"1","cell":["1","AF","AFGHANISTAN","Afghanistan","AFG","4"]},{"id":"2","cell":["2","AL","ALBANIA","Albania","ALB","8"]},{"id":"3","cell":["3","DZ","ALGERIA","Algeria","DZA","12"]},{"id":"4","cell":["4","AS","AMERICAN SAMOA","American Samoa","ASM","16"]},{"id":"5","cell":["5","AD","ANDORRA","Andorra","AND","20"]},{"id":"6","cell":["6","AO","ANGOLA","Angola","AGO","24"]},{"id":"7","cell":["7","AI","ANGUILLA","Anguilla","AIA","660"]},{"id":"8","cell":["8","AQ","ANTARCTICA","Antarctica",null,null]},{"id":"9","cell":["9","AG","ANTIGUA AND BARBUDA","Antigua and Barbuda","ATG","28"]},{"id":"10","cell":["10","AR","ARGENTINA","Argentina","ARG","32"]}]}
Is there anyone can point me where have I gone wrong?
FYI, if I only set one column for both header and data I didn't find the error.
thanks in advance
20:53
Moderators
30/10/2007
Hello,
You have 5 columns defined, but your response contain 6 like this:
{"page":"1","total":24,"records":239,"rows":[
{"id":"1",
"cell":["1","AF","AFGHANISTAN","Afghanistan","AFG","4"]},
...
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
19:13
20/04/2010
Thanks for the response tony.
CMIIW, is that an issue? Since if I define ONLY ONE column in header using the same JSON data, 6 column in response, the error is gone.
I have tried to debug the jqgrid to findout what is happening. It seems that g only has single header. While the jqgrid trying to access non-existance index in g.headers since 1 is assigned to c as the second index (which is not exist in the given runtime).
I may have do it in the wrong way or miss some setting in using jqgrid. And forgive me for my english, since it is not my native language. 😀
Thanks in advance
Most Users Ever Online: 715
Currently Online:
44 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66