Forum


23:32

08/01/2009

I'm trying to do a mock up and need some sample data but need it locally. I can't take the time right now to do all the ajax stuff right now and write the server side code to generate my result set. What I want to do is just create some sample data and put it in a local variable and use that to load the grid instead of some url.... is this possible. I'm pretty sure it is, but after looking around I can't see any reference... here is what I have...
<link rel="stylesheet" type="text/css" href="/public/jqGrid364/css/ui.jqgrid.css"></link>
<script type="text/javascript" src="../../public/jqGrid364/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../../public/jqGrid364/js/i18n/grid.locale-en.js"></script>
<script type="text/javascript" src="../../public/jqGrid364/js/jquery.jqGrid.min.js"></script>
<script>
var testData = {total:"1",
page:"1",
records:"10",
rows:[{id:"1",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"2",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"3",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"4",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"5",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"6",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"7",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"8",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"9",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
,{id:"10",cells:["1", "0", "4", "0", "0", "0", "0", "0", "0"]}
]};
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:testData,
datatype:'json',
colNames:['Order','WC1','WC2','WC3','WC4','WC5','WC6','WC7','WC8','WC9'],
colModel:[
{name:'invid', index:'invid', width:55},
{name:'wc1', index:'wc1', width:20},
{name:'wc2', index:'wc2', width:20},
{name:'wc3', index:'wc3', width:20},
{name:'wc4', index:'wc4', width:20},
{name:'wc5', index:'wc5', width:20},
{name:'wc6', index:'wc6', width:20},
{name:'wc7', index:'wc7', width:20},
{name:'wc8', index:'wc8', width:20},
{name:'wc9', index:'wc9', width:20}],
pager: '#pager',
rowNum:10,
rowList:[10,20,30],
caption: 'Customer Order Progress:'
});
});
</script>
What am I doing wrong? The jquery version that is bundled with the jqGrid download is 1.3.2.min.js. Can I use 1.4.1? I am getting an error in firebug that says... M.url.match is not a function.
Thanks.
Bryce
18:30

08/01/2009

I got it working. There is an example under Loading Data -> Array Data on this page... http://trirand.com/blog/jqgrid.....qgrid.html
Most Users Ever Online: 715
Currently Online:
64 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