Forum

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

Search Forums:


 






Tree – client side population (jgGrid 4.1.1, jQuery 1.6.1)

UserPost

23:38
30/06/2011


efreeman518

New Member

posts 1

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 });

 }


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

27 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9596

Posts: 28792

Membership:

There are 10196 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 (7010 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information