<?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: newbie treegrid questions...</title>
	<link>http://www.trirand.com/blog/?page_id=393/treegrid/newbie-treegrid-questions</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/newbie-treegrid-questions/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>bergzilla on newbie treegrid questions...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/newbie-treegrid-questions#p28557</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/newbie-treegrid-questions#p28557</guid>
        	        	<description><![CDATA[<p>Ugh, my name is berg and I am lord of the idiots...</p>
<p>Adjacency only has one n...</p>
<p>After correcting that, it all works great! Thanks anyone and everyone who took a look!</p></p>
]]></description>
        	        	<pubDate>Tue, 02 Apr 2013 00:28:07 +0300</pubDate>
        </item>
        <item>
        	<title>bergzilla on newbie treegrid questions...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/treegrid/newbie-treegrid-questions#p28556</link>
        	<category>TreeGrid</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/treegrid/newbie-treegrid-questions#p28556</guid>
        	        	<description><![CDATA[<p>&#160;Say I have a simple hierarchy of XML like&#8230;</p>
<p>&#60;root&#62;</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#60;item label="Parent1&#8243; level="0&#8243; leaf="false" parent="" id="Parent1&#8243;&#62;</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#60;item label="Child1&#8243; level="1&#8243; leaf="true" parent="Parent1&#8243; id="Parent1/Child1&#8243;&#62;</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#60;item label="Child2&#8243; level="1&#8243; leaf="true" parent="Parent1&#8243; id="Parent1/Child2&#8243;&#62;</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#60;/item&#62;</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#60;item label="Parent2&#8243; level="0&#8243; leaf="false" parent="" id="Parent2&#8243;&#62;</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#60;item label="Child1&#8243; level="1&#8243; leaf="true" parent="Parent2&#8243; id="Parent2/Child1&#8243;&#62;</p>
<p>&#160; &#160; &#160; &#160; &#160; &#160; &#60;/item&#62;</p>
<p>&#60;/root&#62;</p>
</p>
<p>And my treegrid is setup something like this&#8230;</p>
<p>var colNames = [&#39;Label&#39;];<br />var colModel = [	{name:&#39;label&#39;, xmlmap: function (obj) { return $(obj).attr("label");}} ];</p>
</p>
<p>$("#myTreeGrid").jqGrid({</p>
<p style="padding-left: 30px;">treeGrid: true,<br /> treeGridModel: &#39;adjancency&#39;,<br /> ExpandColClick: true,<br />ExpandColumn: &#39;Label&#39;,<br /> datatype: &#39;xmlstring&#39;,<br />datastr: myXML,<br />colNames: colNames,<br />colModel: colModel,<br /> xmlReader: { <br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; root: "root",&#160;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; row: "item",&#160;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; repeatitems: false<br /> },<br /> treeReader: {<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; level_field: "[level]",<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; parent_id_field: "[parent]",<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; leaf_field: "[leaf]",<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; expanded_field: "[expanded]"<br /> },<br />gridview: false,<br />caption: &#39;My Tree Sample&#39;,</p>
<p>});</p>
<p>Now this XML is a bit different than the single example that google is giving me. I was hoping this would work due&#160;to the little xmlmap trick being able to pull out attributes via the function call ie&#160;xmlmap: function (obj) { return $(obj).attr("label");} that I&#39;m using in the colModel and being able to use attributes in the treeReader and that all seems to work well but the one thing that I can&#39;t get to work for the life of me is being able to expand/collapse the parent.</p>
<p>I&#39;m getting what looks like parent and children in the tree(they&#39;ve got the right icons) but they don&#39;t seem to be connected. Children are starting off fully expanded even though their expand field is set to false and clicking on the parent&#39;s expand/collapse triangle just seems to stick to expand regardless of what the field was set to.</p>
<p>I&#39;m guessing I&#39;m missing a field in my treeReader for id to connect parent and children but all I can find in the documentation available is level_field, parent_id_field, leaf_field, and expanded_field for the adjancency model. I&#39;ve also tried setting the id field in the xmlReader but haven&#39;t had any luck.</p>
<p>Could it also be that I&#39;m missing a field for setting the loaded boolean? I know in the standard XML treegrid example, it&#39;s recommended that the last tag for each row be set to true(I think) to keep treegrid from contacting the server for the children&#39;s contents. Could it be that my parent expand is stuck because its trying to pull more data from the server even though I don&#39;t want it to?</p>
<p>Does anyone have any suggestions? I feel like I&#39;m so close to getting this to work and I&#39;m getting tripped up on something I&#39;m just not finding.</p>
<p>Also, the links that I&#39;m guessing explain what the nested and adjancency models really mean seem to be broken. Does anyone have a simple explanation for the difference between the two? Judging from the differences in their treeReaders, they seem a bit backwards to me. Wouldn&#39;t adjacent mean things are side by side which would use the left/right fields?</p>
<p>And kind of a side comment that I hope doesn&#39;t come off as snarky <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" /> It&#39;s kind of a bummer to me that I&#39;ve got a very hierarchical XML but I still have to go thru and explicitly setup parent/child relationships via either tags or attributes.</p>
<p>Thanks for any advice you can drop on me!</p>
]]></description>
        	        	<pubDate>Mon, 01 Apr 2013 22:56:09 +0300</pubDate>
        </item>
</channel>
</rss>