Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
javascript error when creating treegrid
12/04/2012
18:10
Avatar
nhowerton
Member
Members
Forum Posts: 3
Member Since:
10/04/2012
sp_UserOfflineSmall Offline

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>
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
29 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information