I\'m new in jqgrid, I\'m just trying thes example to work. I have a html file only, nothing more. When I ran this file, array data is not showing. What am I missing here? Th
I am also trying to develop the same example but also received same error and after doing lots of try and error , finally i come to the right path. i am putting my sample example for loading array data in jqgrid. this is working example.
i have included lots of script file in my head tag because i am not sure about it. i Remove '<' and '>' tag please add it. working code is :-
html xmlns="http://www.w3.org/1999/xhtml
head
script type="text/javascript"
jQuery(document).ready(function()
{ jQuery("#list4").jqGrid
(
{
data: mydata,
datatype: "local",
height: 250,
colNames:['Inv No','Date', 'Client'],
colModel:[
{name:'id',index:'id', width:60},
{name:'invdate',index:'invdate' },
{name:'name',index:'name', width:100}
],
pager: '#pager',
rowNum:2,
rowList:[10,20,30],
sortname: 'id',
sortorder: 'desc',
viewrecords: true,
multiselect: true,
imgpath: "themes/basic/images",
caption: "Manipulating Array Data"
}
);
var mydata = [ {id:"1",invdate:"2007-10-01",name:"test"},
{id:"2",invdate:"2007-10-01",name:"test"},
{id:"3",invdate:"2007-10-01",name:"test"},
{id:"4",invdate:"2007-10-01",name:"test"},
{id:"5",invdate:"2007-10-01",name:"test"},
{id:"6",invdate:"2007-10-01",name:"test"},
{id:"7",invdate:"2007-10-01",name:"test"},
{id:"8",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"},
{id:"1",invdate:"2007-10-01",name:"test"}
];
for(var i=0;i<=mydata.length;i++)
jQuery("#list4").addRowData(i, mydata[i]);
}//function
);//ready
script
head
body
This is table
table id="list4"
/table
div id="pager" class="scroll" style="text-align:center;"
/div
This is table
/body
/html