Forum



21:52

24/04/2010

I am having problems getting data array to work based on what I've read in the example and in this forum. I must be missing something basic. My symptom is that nothing is appearing in the web browser when I load the page. I appreciate any help here.
Here is what I currently have (excerpted). All the xml and files are in the same directory as the .html file:
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="./jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="./ui.jqgrid.css" />
<script src="./grid.locale-en.js" type="text/javascript"></script>
<script src="./jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list4″).jqGrid({
datatype: "local",
height: 250,
colNames:['Backup No','Date', 'Size', 'Direction','Elapsed Time','Completed?','Notes'],
colModel:[
{name:'id',index:'id', width:60, sorttype:"int"},
{name:'bkupdate',index:'bkupdate', width:90, sorttype:"date"},
{name:'size',index:'size', width:60},
{name:'direction',index:'direction', width:150, align:"left",sorttype:"float"},
{name:'dur',index:'dur', width:80, align:"right",sorttype:"float"},
{name:'succ',index:'succ', width:30,align:"right",sorttype:"float"},
{name:'note',index:'note', width:150, sortable:false}
],
pager: jQuery('#pager'),
rowNum:10,
viewrecords: true,
multiselect: true,
caption: "Offsite Data Transfer Log Summary"
});
var mydata = [
{id:"1",bkupdate:"2010-04-30",size:"12GB",direction:"LAN to DC1",dur:"450",succ:"Y",note:"note"},
{id:"2",bkupdate:"2010-04-29",size:"12GB",direction:"LAN to DC1",dur:"430",succ:"Y",note:"note2"},
{id:"3",bkupdate:"2010-04-28",size:"11GB",direction:"LAN to DC1",dur:"420",succ:"Y",note:"note3"},
{id:"4",bkupdate:"2010-04-27",size:"11GB",direction:"LAN to DC2",dur:"425",succ:"Y",note:"note"},
{id:"5",bkupdate:"2010-04-26",size:"10GB",direction:"LAN to DC1",dur:"410",succ:"Y",note:"note2"},
{id:"6",bkupdate:"2010-04-25",size:"10GB",direction:"LAN to DC1",dur:"400",succ:"Y",note:"note3"},
{id:"7",bkupdate:"2010-04-24",size:"9GB",direction:"LAN to DC1",dur:"390",succ:"Y",note:"note"},
{id:"8",bkupdate:"2010-04-23",name:"9GB",direction:"LAN to DC1",dur:"380",succ:"Y",note:"note2"},
{id:"9",bkupdate:"2010-04-22",name:"8GB",direction:"LAN to DC1",dur:"375",succ:"Y",note:"note3"}
];
for(var i=0;i<=mydata.length;i++)
jQuery("#list4″).addRowData(i+1,mydata[i]);
});
</script>
</head>
<body>
<table id="list4"></table>
</body>
</html>
[Image Can Not Be Found] |
15:06

Moderators
30/10/2007

Hello,
Seems that everthing is ok. Could you please remove this from grid option:
pager: jQuery('#pager'),
The pager is not defined, but you point to it.
Do you have any error when you run this script?
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.
14:45

Moderators
30/10/2007

Hello,
I'm not sure, but if you set to use the new API, you will need to do it so:
for(var i=0;i<=mydata.length;i++)
jQuery("#list4″).jqGrid('addRowData',i+1,mydata[i]);
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.
Most Users Ever Online: 715
Currently Online:
72 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