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_Related Related Topics sp_TopicIcon
Tree - client side population (jgGrid 4.1.1, jQuery 1.6.1)
30/06/2011
23:38
Avatar
efreeman518
New Member
Members
Forum Posts: 1
Member Since:
30/06/2011
sp_UserOfflineSmall Offline

Trying to us the jqgrid as a tree, prefer to add nodes manually, something like the code below.  I have tried using the addChildNode method with no luck. I know the docs say 'Currently jqGrid can work only with data returned from server.', but the 4.0.0 changes "Added method addChildNode".  I am using custom async (jQuery ajax) calls to retrieve data from the server, upon callback I would like to just add the appropriate nodes to the tree. Also the parameters to addChildNode are defined as: nodeid, parentid, data, but the data parameter also contains nodeid, parentid - ?

$("#tree1").jqGrid({

datatype: function (treePostData) { treeLoad(treePostData); },

colNames: ["id", "name"],

colModel: [

{ name: 'id', index: 'id', width: 1, hidden: true, key: true },

{ name: 'name', index: 'name', width: 180 }

],

height: '100%',

rowNum: 10000,

sortname: 'id',

treeGrid: true,

treeGridModel: 'adjacency',

treedatatype: function (treePostData) { treeLoad(treePostData); },

ExpandColumn: 'name',

caption: "Tree Grid"

});

function treeLoad(treePostData){

//add nodes to the grid

//not working... nodeid, parentid, data 

//the following line throws a javascript error in jquery-1.6.1, line 998: 'undefined' is null or not an object

$("#tree1").jqGrid("addChildNode", "1", null, { id: "1", name: "xyz1", level: 0, parent: null, isLeaf: false, expanded:false });

 }

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
40 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