Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






javascript error when creating treegrid

No Tags
UserPost

18:10
12/04/2012


nhowerton

Member

posts 3

I'm using jqGrid 4.3.1 to create a treegrid with local data. I keep getting the following javascript error:

Uncaught TypeError: Cannot read property '0' of undefined

I can't figure out what is wrong with my jqGrid definition. I've looked at the wiki, the forums, and stackoverflow. It looks right to me, but I can't seem to figure this one out. Any help would be greatly appreciated. Here's my code:

<html>
   <head>
…(script includes)
   </head>
<body>
<div id="orgTreeFilter">
<table id="orgTree"></table>
<div id="orgPager"></div>
</div>
</body>
</html>
<script>
$(document).ready(function() {
        var orgs = [];
        var orgs[0] = {
               organizationId: 16702,
               orgName: 'Test Org',
level: 0,
parent: 0,
isLeaf: true,
expanded: false,
loaded: true,
selected: false
};
$('#orgTree').jqGrid({
data: orgs,
colNames: ["organizationId", "Organization", ""],
colModel : [
{name:'organizationId', index:'organizationId', hidden:true},
{name:'orgName', index:'orgName'},
{name:'selected', index:'selected', width:80,align:'center', editable: true, edittype: 'checkbox', formatter:'checkbox', formatoptions: {disabled: false, class: 'selected'}}
],
rowNum: 1000,
treeGrid: true,
treeGridModel: 'adjacency',
treedatatype: 'local',
ExpandColumn: 'orgName',
pager: '#orgPager'           
});
$('#orgTree')[0].addJSONData({
     total: 1,
     page: 1,
     records: orgs.length,
     rows: orgs
  });
});
</script>
No Tags

About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

84 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9578

Posts: 28748

Membership:

There are 10063 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (6999 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information