<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Remember state with YUI TreeView</title>
	<atom:link href="http://johnmee.com/2008/07/expand-dynamic-yui-treeview-to-leaf/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnmee.com/2008/07/expand-dynamic-yui-treeview-to-leaf/</link>
	<description>A Programmer in Sydney, Australia</description>
	<lastBuildDate>Sat, 31 Mar 2012 04:02:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: John</title>
		<link>http://johnmee.com/2008/07/expand-dynamic-yui-treeview-to-leaf/comment-page-1/#comment-1276</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sat, 28 Mar 2009 01:29:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmee.com/?p=56#comment-1276</guid>
		<description>Petronel:

No. There were no loops.

When the client-side code was generated at the server-side I embedded an identifier into each node (&quot;pos_id&quot;).  When the code runs on the client it gets the node it wants by calling the &quot;getNodeByProperty&quot; function with my identifier &quot;pos_id&quot; and a value for it.</description>
		<content:encoded><![CDATA[<p>Petronel:</p>
<p>No. There were no loops.</p>
<p>When the client-side code was generated at the server-side I embedded an identifier into each node (&#8220;pos_id&#8221;).  When the code runs on the client it gets the node it wants by calling the &#8220;getNodeByProperty&#8221; function with my identifier &#8220;pos_id&#8221; and a value for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Petronel MALUTAN</title>
		<link>http://johnmee.com/2008/07/expand-dynamic-yui-treeview-to-leaf/comment-page-1/#comment-1272</link>
		<dc:creator>Petronel MALUTAN</dc:creator>
		<pubDate>Mon, 23 Mar 2009 07:01:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmee.com/?p=56#comment-1272</guid>
		<description>Hi John Mee

I am wondering if you can remember if the whole code below was inside a loop which iterated the first children of the tree.getRoot() ?

&lt;code&gt;&lt;pre&gt;
	for(var i=0; i &lt; root.children.length; i++){
		var node = root.children[i];
		var pozid = node.data.pozid;
		if (the node should be expanded){
			(your code)*
		}
	}
&lt;/pre&gt;&lt;/pre&gt;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi John Mee</p>
<p>I am wondering if you can remember if the whole code below was inside a loop which iterated the first children of the tree.getRoot() ?</p>
<p><code>
<pre>
	for(var i=0; i < root.children.length; i++){
		var node = root.children[i];
		var pozid = node.data.pozid;
		if (the node should be expanded){
			(your code)*
		}
	}
</pre>
</pre>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://johnmee.com/2008/07/expand-dynamic-yui-treeview-to-leaf/comment-page-1/#comment-677</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Thu, 08 Jan 2009 16:53:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmee.com/?p=56#comment-677</guid>
		<description>Hi John,
Do you have any idea how to get a node in a treeview that currently has focus? I&#039;ve scoured the docs but I can&#039;t find any way to do this. If you have any thoughts they would be gratefully received.</description>
		<content:encoded><![CDATA[<p>Hi John,<br />
Do you have any idea how to get a node in a treeview that currently has focus? I&#8217;ve scoured the docs but I can&#8217;t find any way to do this. If you have any thoughts they would be gratefully received.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://johnmee.com/2008/07/expand-dynamic-yui-treeview-to-leaf/comment-page-1/#comment-518</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 10 Dec 2008 00:49:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmee.com/?p=56#comment-518</guid>
		<description>Hi Das,

Yes got it working.

Sadly I don&#039;t have a copy of the whole thing as it stayed at the company it was for and I managed to screw up the virtual server that i reserved as my backup. Whatsmore this piece will be deployed behind authentication.  Sorry. Yes the fragment is specific to my problem and a hasty post.

Some notes in looking at it now...

&lt;strong&gt;1) &quot;during page load&quot; in the psuedocode&lt;/strong&gt;

Not shown in the fragment.  I used the yui loader and had this fragment invoked when the yui considered the page loaded

&lt;strong&gt;2) &quot;get the specific team node&quot;&lt;/strong&gt;

Refers to the first line - var teamnode.  However I&#039;ve not shown the construction of the tree in this fragment which is a bit poor of me. 

During tree construction the top level nodes were keyed with &quot;tmn_id&quot; and the middle level keyed &quot;pos_id&quot; which is obviously significant as these are the keys &#039;getNodeByProperty&#039; uses to find the node. Hopefully how I did that is obvious when you examine the API to construct nodes.


&lt;strong&gt;3) #variable_name#&lt;/strong&gt;

The server-side was Coldfusion and this is how coldfusion injects variables into markup.  So &quot;getPosIds&quot; refers to a server-side variable containing a query resultset.  Thus &quot;#getPosIds.tmd_id#&quot; is substituted with the contents of the first &quot;tmn_id&quot; field from the first row. An integer.  eg &quot;44&quot;.

So the client would actually be sent...

var teamnode = tree.getNodeByProperty(&quot;tmn_id&quot;,&quot;44&quot;);

&lt;strong&gt;4) the &lt;em&gt;how&lt;/em&gt;&lt;/strong&gt;

I&#039;ve done it by creating a routine to expand the innermost node. Then I&#039;ve attached that routine to an event which is fired after the top-level node is expanded.  Thus, by expanding the top level node, the child node gets opened as well.  There&#039;s a little gotcha in that you want the routine to self-destruct on first use - hence the unsubscribe.

Maybe that helps.  I think the secret lies in understanding &lt;em&gt;how&lt;/em&gt; it was done rather than trying to copy the code fragment.

John</description>
		<content:encoded><![CDATA[<p>Hi Das,</p>
<p>Yes got it working.</p>
<p>Sadly I don&#8217;t have a copy of the whole thing as it stayed at the company it was for and I managed to screw up the virtual server that i reserved as my backup. Whatsmore this piece will be deployed behind authentication.  Sorry. Yes the fragment is specific to my problem and a hasty post.</p>
<p>Some notes in looking at it now&#8230;</p>
<p><strong>1) &#8220;during page load&#8221; in the psuedocode</strong></p>
<p>Not shown in the fragment.  I used the yui loader and had this fragment invoked when the yui considered the page loaded</p>
<p><strong>2) &#8220;get the specific team node&#8221;</strong></p>
<p>Refers to the first line &#8211; var teamnode.  However I&#8217;ve not shown the construction of the tree in this fragment which is a bit poor of me. </p>
<p>During tree construction the top level nodes were keyed with &#8220;tmn_id&#8221; and the middle level keyed &#8220;pos_id&#8221; which is obviously significant as these are the keys &#8216;getNodeByProperty&#8217; uses to find the node. Hopefully how I did that is obvious when you examine the API to construct nodes.</p>
<p><strong>3) #variable_name#</strong></p>
<p>The server-side was Coldfusion and this is how coldfusion injects variables into markup.  So &#8220;getPosIds&#8221; refers to a server-side variable containing a query resultset.  Thus &#8220;#getPosIds.tmd_id#&#8221; is substituted with the contents of the first &#8220;tmn_id&#8221; field from the first row. An integer.  eg &#8220;44&#8243;.</p>
<p>So the client would actually be sent&#8230;</p>
<p>var teamnode = tree.getNodeByProperty(&#8220;tmn_id&#8221;,&#8221;44&#8243;);</p>
<p><strong>4) the <em>how</em></strong></p>
<p>I&#8217;ve done it by creating a routine to expand the innermost node. Then I&#8217;ve attached that routine to an event which is fired after the top-level node is expanded.  Thus, by expanding the top level node, the child node gets opened as well.  There&#8217;s a little gotcha in that you want the routine to self-destruct on first use &#8211; hence the unsubscribe.</p>
<p>Maybe that helps.  I think the secret lies in understanding <em>how</em> it was done rather than trying to copy the code fragment.</p>
<p>John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Das</title>
		<link>http://johnmee.com/2008/07/expand-dynamic-yui-treeview-to-leaf/comment-page-1/#comment-502</link>
		<dc:creator>Das</dc:creator>
		<pubDate>Mon, 08 Dec 2008 15:24:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmee.com/?p=56#comment-502</guid>
		<description>John,

Did you get this working? I am also trying to do the same thing. Could you please send me your code?</description>
		<content:encoded><![CDATA[<p>John,</p>
<p>Did you get this working? I am also trying to do the same thing. Could you please send me your code?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

