Forum


04:00

10/08/2009

Hi folks,
I have been using jqGrid just for a couple weeks, i read some docs and blogs and build my grid well. At least i thought well. My web application using grid as a tree grid to show some values. The thing is jqGrid either works or not works with the same code.
The problem prevent the loading data to the grid when the page loading. Search the error and it seems that i forgot include some libraries jqGrid use, although i load everything i still get this weird error. It is weird because it works well sometimes, after working i start again application without any modifications then i get error.
Error string is "Object doesn't support this property or method", in the "grid.base.js" file there is a function called "addCell", VS 2008 always points the last row of this function
addCell = function(rowId,cell,pos,irow, srvr) {
var v,prp;
v = formatter(rowId,cell,pos,srvr,'add');
prp = formatCol( pos,irow);
return "<td role=\\"gridcell\\" "+prp+" title=\\""+$.jgrid.stripHtml(v)+"\\">"+v+"</td>";
},
I think i'm missing something very easy but i couldn't find out, am i the only one getting this error out there?
Here is the code of my aspx file i get error :
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/thickbox.css" />
<script type="text/javascript" src="script/jquery-1.3.2.js"></script>
<script type="text/javascript" src="script/jquery-ui.js"></script>
<script type="text/javascript" src="script/jquery.jqGrid.js"></script>
<script type="text/javascript" src="script/grid.locale-tr.js"></script>
<script type="text/javascript" src="script/swfobject.js"></script>
<script type="text/javascript" src="script/thickbox.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'XML4Live.aspx',
datatype: 'xml',
mtype: 'POST',
colNames:['id','Yer','FiÅŸ Miktar','FiÅŸ Tutar', 'Ort.(%)'],
colModel :[
{name:'id', index:'id', width:1, hidden:true,key:true},
{name:'Yer', index:'Donem', width:150, align:'left'},
{name:'FisMiktar', index:'fm', width:55, align:'right', formatter:'number'},
{name:'FisTutar', index:'ft', width:90, align:'right', formatter:'currency'},
{name:'Ort', index:'ort', width:80, align:'right', formatter:'number'},
],
pager: '#pager',
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn : 'Yer',
hegiht : 300,
width : 700,
caption: 'Canlı Bilgi (Bugünü Gösterir)'
});
});
</script>
<script type="text/javascript">
var params = {
menu: "false",
wmode: "transparent"
};
var attributes = {
id: "ofc",
name: "ofc",
wmode: "transparent"
};
swfobject.embedSWF("open-flash-chart.swf", "ofc", "750", "300",
"9.0.0", "expressInstall.swf",{"data-file":"XML4LiveGraph.aspx"}, params, attributes);
</script>
</head>
<body>
<a href="AnalizGiris.aspx?height=200&width=400" title="Analiz Giriş Ekranı" class="thickbox">Analiz</a>
<form id="form1" runat="server">
<table id="list"></table>
<div id="pager"></div>
<br />
<div id="ofc"></div>
</form>
</body>
</html>
06:04

Moderators
30/10/2007

Hello,
Maybe you have inconsistency in the data returned from server - check the response - in most cases the number of the returned cols should equal of those defined in colModel.
Regards
Tony
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.
06:59

10/08/2009

Hi tony,
Thank you very much for your response.
According your comment, i checked my data and found out nothing weird. Then i decided to give solid xml which has no error and built by hand (not dynamic). It only has one record, i thought that if i feed the grid simplest data, i shouldn't have the error if the error depends on the data.
I used same column structure with my previous post. And here is the data :
07:36

Moderators
30/10/2007

colModel :[
{name:'id', index:'id', width:1, hidden:true,key:true},
{name:'Yer', index:'Donem', width:150, align:'left'},
{name:'FisMiktar', index:'fm', width:55, align:'right', formatter:'number'},
{name:'FisTutar', index:'ft', width:90, align:'right', formatter:'currency'},
{name:'Ort', index:'ort', width:80, align:'right', formatter:'number'}, <----- Error here - remove this
],
Regards
Tony
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.
09:31

Coming form the C# and Java world and being new to Javascript I am amazed at the richness of fucntionality and good looks of the grid. Everything works great for me, except one problem, exactly the same as reported here. For me this happens only in IE and only on a first load after the browser stratup. Subseqent loads work fine. Fifefox and Chrome do not have the problem. The fix suggested by Tony (removing comma?) does not apply to me, I do not have comma at the last coulmn definition. Here is my script:
jQuery(document).ready(function(){
jQuery("#treegridc").jqGrid({
treeGridModel: "adjacency",
ExpandColumn : 'customer',
ExpandColClick : 'customer',
url: 'b.do?q=m',
datatype: "xml",
mtype: "POST",
colNames:['No','Customer', 'Sector', 'Volume', 'T Volume','CT Volume','Hit Ratio','Tickets', 'T Tickets', 'CT Tickets', 'Hit Ratio'],
colModel:[
{name:'id',index:'id', width:1,hidden:true,key:true,sortable:false},
{name:'customer',index:'customer', width:270,sortable:false},
{name:'sector',index:'sector', width:90,sortable:false},
{name:'volume',index:'volume', width:80, align:"right",sortable:false},
{name:'tvolume',index:'tvolume', width:90, align:"right",sortable:false},
{name:'ctvolume',index:'ctvolume', width:105, align:"right",sortable:false},
{name:'vratio',index:'vratio', width:70, align:"right",sortable:false},
{name:'tickets',index:'tickets', width:70, align:"right",sortable:false},
{name:'ttickets',index:'ttickets', width:90, align:"right",sortable:false},
{name:'cttickets',index:'cttickets', width:105, align:"right",sortable:false},
{name:'tratio',index:'tratio', width:70, align:"right",sortable:false}
],
height:'auto',
imgpath: "jqgrid3.5/css/redmond/images",
treeGrid: true,
caption: "Hit ratios by customer for last 15 days"
});
});
I traced the error to the same line in addCell in grid.base.js:
return "<td role=\\"gridcell\\" "+prp+" title=\\""+$.jgrid.stripHtml(v)+"\\">"+v+"</td>";
02:33

Moderators
30/10/2007

Hello,
Do you have any special characters in the data?
P.S in 3.5 version you do not need
imgpath: “jqgrid3.5/css/redmond/images”,
The parameter is removed and not needed. Also I will remove all these from the demo files.
Best Regards
Tony
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.
16:51

I downloaded jqGrid again and the error is gone. Not sure if my there were some changes in the code since previous download or my installation was corrupted, but I do not see the error anymore. There are might be special characters, but I wrap them in CDATA.
Removed imgpath as well.
Thanks, Tony!
Alex
Most Users Ever Online: 715
Currently Online:
127 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