<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Tree - client side population (jgGrid 4.1.1, jQuery 1.6.1)</title>
	<link>http://www.trirand.com/blog/?page_id=393/treegrid/tree-client-side-population-jggrid-4-1-1-jquery-1-6-1</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/treegrid/tree-client-side-population-jggrid-4-1-1-jquery-1-6-1/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>efreeman518 on Tree - client side population (jgGrid 4.1.1, jQuery 1.6.1)</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/tree-client-side-population-jggrid-4-1-1-jquery-1-6-1#p23824</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/tree-client-side-population-jggrid-4-1-1-jquery-1-6-1#p23824</guid>
        	        	<description><![CDATA[<p>Trying to us the jqgrid as a tree, prefer to add nodes manually, something like the code below. &#160;I have tried using the addChildNode method with no luck. I know the docs say &#39;Currently jqGrid can work only with data returned from server.&#39;, but the 4.0.0 changes "Added method addChildNode". &#160;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 - ?</p>
</p>
<p>$("#tree1").jqGrid({</p>
<p><span style="white-space: pre;"> </span>datatype: function (treePostData) { treeLoad(treePostData); },</p>
<p><span style="white-space: pre;"> </span>colNames: ["id", "name"],</p>
<p><span style="white-space: pre;"> </span>colModel: [</p>
<p><span style="white-space: pre;"> </span>{ name: &#39;id&#39;, index: &#39;id&#39;, width: 1, hidden: true, key: true },</p>
<p><span style="white-space: pre;"> </span>{ name: &#39;name&#39;, index: &#39;name&#39;, width: 180 }</p>
<p><span style="white-space: pre;"> </span>],</p>
<p><span style="white-space: pre;"> </span>height: &#39;100%&#39;,</p>
<p><span style="white-space: pre;"> </span>rowNum: 10000,</p>
<p><span style="white-space: pre;"> </span>sortname: &#39;id&#39;,</p>
<p><span style="white-space: pre;"> </span>treeGrid: true,</p>
<p><span style="white-space: pre;"> </span>treeGridModel: &#39;adjacency&#39;,</p>
<p><span style="white-space: pre;"> </span>treedatatype: function (treePostData) { treeLoad(treePostData); },</p>
<p><span style="white-space: pre;"> </span>ExpandColumn: &#39;name&#39;,</p>
<p><span style="white-space: pre;"> </span>caption: "Tree Grid"</p>
<p>});</p>
</p>
<p>function treeLoad(treePostData){</p>
<p><span style="white-space: pre;"> </span>//add nodes to the grid</p>
<p><span style="white-space: pre;"> </span>//not working... nodeid, parentid, data&#160;</p>
<p><span style="white-space: pre;"> </span>//the following line throws a javascript error in jquery-1.6.1, line 998: &#39;undefined&#39; is null or not an object</p>
<p><span style="white-space: pre;"> </span>$("#tree1").jqGrid("addChildNode", "1", null, { id: "1", name: "xyz1", level: 0, parent: null, isLeaf: false, expanded:false });</p>
<p>&#160;}</p>
]]></description>
        	        	<pubDate>Thu, 30 Jun 2011 23:38:05 +0300</pubDate>
        </item>
</channel>
</rss>