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
addChildNode
15/09/2011
19:29
Avatar
JoshD
New Member
Members
Forum Posts: 2
Member Since:
15/09/2011
sp_UserOfflineSmall Offline

I'm currently working on getting a treegrid going where I'm overriding the data functions to call a thrift service to fill in the data. The idea is that I load only the parent nodes then when the node is expanded it will dynamically call the thrift service to fill in the data. I have run into some quirks with the way the treegrid is behaving when I try to load the children dynamically. It will load the intial list fine but when I go to dynamically load the child it's not adding it when the parent is expanded. Now if you expand the second entry it add the child to the list in the correct position but it doesn't see it as a child of 287.

I can't seem to grasp what I'm doing wrong with it that it doesn't want to properly add as a child.

// The data that is returned via thrift to fill in the intial entry in the table

{
"total" : "13″,
"page":"1″,
"records": "720″,
"rows" : [

{"id" : "287","cell" : ["287","MDXX00025",true,0,null,false,false] }
,{"id" : "544″,"isLeaf":true,"cell" : ["544","MDXX00460",true,0,null,false,false] }]
}

 // How jqGrid is configured with a oData object that contains the child I want to fill in.

var oData = { "rows" : [
{"id" : "7220","parent":287,"level":"1","isLeaf":true,"loaded":true,"empty":"MDXX00450" }]
};

function DoWork(postdata)
{
     var sData = client.NavigateTable(postdata._search,postdata.page,postdata.rows,postdata.sidx,

            postdata.sord,postdata.totalrows);
     var obj = jQuery.parseJSON(sData);
     var thegrid = jQuery("#addtree")[0];
     thegrid.addJSONData(obj);
}

function DoTreeWork(postdata)
{
     var thegrid = $("#addtree");
     thegrid.jqGrid ('addChildNode', oData.rows[0].id, oData.rows[0].parent, oData.rows[0]);
}

jQuery(document).ready(function(){
 
    $.jgrid.defaults = $.extend($.jgrid.defaults,{loadui:"enable"});
    jQuery("#addtree").jqGrid({
    datatype: function(postdata)
    {
        DoWork(postdata);
    },
    treedatatype: function (postdata)
    {
        DoTreeWork(postdata);
    },
    treeGrid: true,
    treeGridModel: 'adjacency',
       colNames:["id","empty","docno,"],
       colModel:[
        {name:'id',index:'id', width:20,key:true, editable:false},
        {name:'empty',index:'empty',width:10},
           {name:'docno',index:'docno', width:30, editable:true}
       ],
    pager : "#paddtree",
    treeGrid: true,
    ExpandColumn : 'name',
    editurl:'server.asp',
    viewrecords: true,
    autowidth: true,
    height:'400',
    rowNum:52,
    rowTotal:100,
    gridview: true,
    sortorder: "asc",
    sortname: 'id',
    caption: "Grid"
});
jQuery("#addtree").jqGrid('navGrid',"#paddtree",{edit:true,add:false,del:true,search:false});
});

I have also noted that the same added passed into addJSONData will not work with the addChildNode.  I'm not sure if this is by design or just an oversight. This whole example functions fine if all the data is passed at once at the beginning to addJSONData. Any help would be appreciated.

Attached an image of what it ends up looking like:

BrokenImage Enlarger

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