<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Expanding nodes in a Flex Tree control using the openItems property</title>
	<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Fri, 05 Dec 2008 00:11:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: ILIUS</title>
		<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-16772</link>
		<author>ILIUS</author>
		<pubDate>Tue, 18 Nov 2008 06:14:19 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-16772</guid>
		<description>private function openAllNodes():void {
tree.openItems=dp.descendants("*")
}</description>
		<content:encoded><![CDATA[<p>private function openAllNodes():void {<br />
tree.openItems=dp.descendants(&#8221;*&#8221;)<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Pohlmann</title>
		<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-12027</link>
		<author>Peter Pohlmann</author>
		<pubDate>Tue, 15 Apr 2008 14:47:00 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-12027</guid>
		<description>hello all,



first of all a big respect for this blog.


Got also problems with the vertical scrolling....


Here is nice tutorial for a tree with amfPHP (http://www.sephiroth.it/tutorials/fl...fphp/index.php)

i've used it for my app, but running into some trouble now, with the scrollbars, what i really didn't expect!!

here you can see the app and the source code:
http://www.rootop.de/testing/TestTree.html

it's all german, so when you click on Enomis -&#62; Einzelstoffe-&#62;Obst , then there appears a scrollbar for a short time and then disappears again, even if there are more branches... it really makes me mad.. i tried serveral function like..

//scroll always to bottom, otherwise, only the items are shown, that are in the visible area
tree.verticalScrollPosition=tree.maxVerticalScroll Position;

tree.invalidateList();

tree.validateNow();

but nothing really works. the general problem is, that i don't know when flex display the scrollbar and when not. because in some cases it works.
so, if there is a solution or a workaround, i would be very happy. thanks in advance. kind regards, peter</description>
		<content:encoded><![CDATA[<p>hello all,</p>
<p>first of all a big respect for this blog.</p>
<p>Got also problems with the vertical scrolling&#8230;.</p>
<p>Here is nice tutorial for a tree with amfPHP (http://www.sephiroth.it/tutorials/fl&#8230;fphp/index.php)</p>
<p>i&#8217;ve used it for my app, but running into some trouble now, with the scrollbars, what i really didn&#8217;t expect!!</p>
<p>here you can see the app and the source code:<br />
<a href="http://www.rootop.de/testing/TestTree.html" rel="nofollow">http://www.rootop.de/testing/TestTree.html</a></p>
<p>it&#8217;s all german, so when you click on Enomis -&gt; Einzelstoffe-&gt;Obst , then there appears a scrollbar for a short time and then disappears again, even if there are more branches&#8230; it really makes me mad.. i tried serveral function like..</p>
<p>//scroll always to bottom, otherwise, only the items are shown, that are in the visible area<br />
tree.verticalScrollPosition=tree.maxVerticalScroll Position;</p>
<p>tree.invalidateList();</p>
<p>tree.validateNow();</p>
<p>but nothing really works. the general problem is, that i don&#8217;t know when flex display the scrollbar and when not. because in some cases it works.<br />
so, if there is a solution or a workaround, i would be very happy. thanks in advance. kind regards, peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stone</title>
		<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-7194</link>
		<author>Stone</author>
		<pubDate>Wed, 27 Feb 2008 06:26:19 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-7194</guid>
		<description>It seems in Flex SDK 2.0.1, the vertical scrollbar will not be updated when the openItems is changed. Does anyone know how to fix this?

You can reproduce the problem by just compile the second sample in Flex SDK 2.0.1 and click "Open some nodes", and the vertical scrollbar will not show!</description>
		<content:encoded><![CDATA[<p>It seems in Flex SDK 2.0.1, the vertical scrollbar will not be updated when the openItems is changed. Does anyone know how to fix this?</p>
<p>You can reproduce the problem by just compile the second sample in Flex SDK 2.0.1 and click &#8220;Open some nodes&#8221;, and the vertical scrollbar will not show!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Hollabaugh</title>
		<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-7135</link>
		<author>Craig Hollabaugh</author>
		<pubDate>Fri, 22 Feb 2008 07:06:44 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-7135</guid>
		<description>Peter,
In this statement,

var xList:XMLList = dp..node.(hasOwnProperty("@isOpen") &#38;&#38; @isOpen == "true")

you use the '..' e4x operator to look for node elements with @isOpen attribute and @isOpen is true.

If your XML elements were not  but a collection with different localnames, how could you find all elements with @isOpen attributes

var xList:XMLList = dp..(hasOwnProperty("@isOpen") &#38;&#38; @isOpen == "true")

doesn't compile. I've tried all sorts of things but can't figure out the e4x equivalent to xpath's '//*[@attr]' 

Thanks,
Craig</description>
		<content:encoded><![CDATA[<p>Peter,<br />
In this statement,</p>
<p>var xList:XMLList = dp..node.(hasOwnProperty(&#8221;@isOpen&#8221;) &amp;&amp; @isOpen == &#8220;true&#8221;)</p>
<p>you use the &#8216;..&#8217; e4x operator to look for node elements with @isOpen attribute and @isOpen is true.</p>
<p>If your XML elements were not  but a collection with different localnames, how could you find all elements with @isOpen attributes</p>
<p>var xList:XMLList = dp..(hasOwnProperty(&#8221;@isOpen&#8221;) &amp;&amp; @isOpen == &#8220;true&#8221;)</p>
<p>doesn&#8217;t compile. I&#8217;ve tried all sorts of things but can&#8217;t figure out the e4x equivalent to xpath&#8217;s &#8216;//*[@attr]&#8217; </p>
<p>Thanks,<br />
Craig</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luis</title>
		<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-6239</link>
		<author>Luis</author>
		<pubDate>Mon, 21 Jan 2008 10:10:27 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-6239</guid>
		<description>Hi Peter. 

Are you sure that this last code of your response is working? When i copy into my Flex Builder 3 (Milestone 3 Beta 2) and execute it via Internet Explorer, if i click "Open All" button, Washington and Florida dont show and the scrollbars also dont show, so you have reproduced my problem perfectly with this example!!  

I can´t find a solution for now. I also set the verticalScrollPolicy to "on" but dont work. If i can find a solution, ill tell you.

Thanks and sorry for my poor english

Luis Alcalá</description>
		<content:encoded><![CDATA[<p>Hi Peter. </p>
<p>Are you sure that this last code of your response is working? When i copy into my Flex Builder 3 (Milestone 3 Beta 2) and execute it via Internet Explorer, if i click &#8220;Open All&#8221; button, Washington and Florida dont show and the scrollbars also dont show, so you have reproduced my problem perfectly with this example!!  </p>
<p>I can´t find a solution for now. I also set the verticalScrollPolicy to &#8220;on&#8221; but dont work. If i can find a solution, ill tell you.</p>
<p>Thanks and sorry for my poor english</p>
<p>Luis Alcalá</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-6199</link>
		<author>peterd</author>
		<pubDate>Fri, 18 Jan 2008 15:10:16 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-6199</guid>
		<description>Luis,

I can't seem to reproduce the issue. Using the code from the code from the example above (second example, the first example doesn't have enough data to cause scroll bars to appear), the scrollbars are displaying when I expand the nodes. I even created a bigger data set (code below) and the scrollbars appear correctly also.

Also, you could try explicitly setting the verticalScrollPolicy property to "on" for the Tree and see if that fixes the issue.

I'm using Flex 3 SDK Version 191831. Are you using Flex 2.0.1 or the Flex 3 beta?

If you think it is a bug, can you file a bug report at http://bugs.adobe.com/flex/ and include your source code (or a simple test case showing the behavior) and myself or somebody else can take a look at it.

Thanks,
Peter

&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;!-- http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/ --&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            import mx.utils.ObjectUtil;

            private function openAll():void {
                var items:XMLList = xmlDP..node.(children().length() &#62; 0);
                tree.openItems = items;
            }

            private function closeAll():void {
                tree.openItems = [];
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:XML id="xmlDP"&#62;
        &#60;root&#62;
            &#60;node label="American League"&#62;
                &#60;node label="West"&#62;
                    &#60;node label="Los Angeles" /&#62;
                    &#60;node label="Seattle" /&#62;
                    &#60;node label="Oakland" /&#62;
                    &#60;node label="Texas" /&#62;
                &#60;/node&#62;
                &#60;node label="Central"&#62;
                    &#60;node label="Cleveland" /&#62;
                    &#60;node label="Detroit" /&#62;
                    &#60;node label="Minnesota" /&#62;
                    &#60;node label="Chicago" /&#62;
                    &#60;node label="Kansas City" /&#62;
                &#60;/node&#62;
                &#60;node label="East"&#62;
                    &#60;node label="Boston" /&#62;
                    &#60;node label="New York" /&#62;
                    &#60;node label="Toronto" /&#62;
                    &#60;node label="Baltimore" /&#62;
                    &#60;node label="Tampa Bay" /&#62;
                &#60;/node&#62;
            &#60;/node&#62;
            &#60;node label="National League"&#62;
                &#60;node label="West"&#62;
                    &#60;node label="Arizona" /&#62;
                    &#60;node label="Colorado" /&#62;
                    &#60;node label="San Diego" /&#62;
                    &#60;node label="Los Angeles" /&#62;
                    &#60;node label="San Francisco" /&#62;
                &#60;/node&#62;
                &#60;node label="Central"&#62;
                    &#60;node label="Chicago" /&#62;
                    &#60;node label="Milwaukee" /&#62;
                    &#60;node label="St. Louis" /&#62;
                    &#60;node label="Houston" /&#62;
                    &#60;node label="Cincinnati" /&#62;
                    &#60;node label="Pittsburgh" /&#62;
                &#60;/node&#62;
                &#60;node label="East"&#62;
                    &#60;node label="Philadelphia" /&#62;
                    &#60;node label="New York" /&#62;
                    &#60;node label="Atlanta" /&#62;
                    &#60;node label="Washington" /&#62;
                    &#60;node label="Florida" /&#62;
                &#60;/node&#62;
            &#60;/node&#62;
        &#60;/root&#62;
    &#60;/mx:XML&#62;

    &#60;mx:ApplicationControlBar dock="true"&#62;
        &#60;mx:Button label="Open all" click="openAll();" /&#62;
        &#60;mx:Button label="Close All" click="closeAll();" /&#62;
    &#60;/mx:ApplicationControlBar&#62;

    &#60;mx:Tree id="tree"
            dataProvider="{xmlDP}"
            labelField="@label"
            showRoot="false"
            width="300"
            height="100%"
            verticalScrollPolicy="auto" /&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Luis,</p>
<p>I can&#8217;t seem to reproduce the issue. Using the code from the code from the example above (second example, the first example doesn&#8217;t have enough data to cause scroll bars to appear), the scrollbars are displaying when I expand the nodes. I even created a bigger data set (code below) and the scrollbars appear correctly also.</p>
<p>Also, you could try explicitly setting the verticalScrollPolicy property to &#8220;on&#8221; for the Tree and see if that fixes the issue.</p>
<p>I&#8217;m using Flex 3 SDK Version 191831. Are you using Flex 2.0.1 or the Flex 3 beta?</p>
<p>If you think it is a bug, can you file a bug report at <a href="http://bugs.adobe.com/flex/" rel="nofollow">http://bugs.adobe.com/flex/</a> and include your source code (or a simple test case showing the behavior) and myself or somebody else can take a look at it.</p>
<p>Thanks,<br />
Peter</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- <a href="http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/" rel="nofollow">http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/</a> &#8211;&gt;
&lt;mx:Application xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221;
        layout=&#8221;vertical&#8221;
        verticalAlign=&#8221;middle&#8221;
        backgroundColor=&#8221;white&#8221;&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.utils.ObjectUtil;

            private function openAll():void {
                var items:XMLList = xmlDP..node.(children().length() &gt; 0);
                tree.openItems = items;
            }

            private function closeAll():void {
                tree.openItems = [];
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XML id=&#8221;xmlDP&#8221;&gt;
        &lt;root&gt;
            &lt;node label=&#8221;American League&#8221;&gt;
                &lt;node label=&#8221;West&#8221;&gt;
                    &lt;node label=&#8221;Los Angeles&#8221; /&gt;
                    &lt;node label=&#8221;Seattle&#8221; /&gt;
                    &lt;node label=&#8221;Oakland&#8221; /&gt;
                    &lt;node label=&#8221;Texas&#8221; /&gt;
                &lt;/node&gt;
                &lt;node label=&#8221;Central&#8221;&gt;
                    &lt;node label=&#8221;Cleveland&#8221; /&gt;
                    &lt;node label=&#8221;Detroit&#8221; /&gt;
                    &lt;node label=&#8221;Minnesota&#8221; /&gt;
                    &lt;node label=&#8221;Chicago&#8221; /&gt;
                    &lt;node label=&#8221;Kansas City&#8221; /&gt;
                &lt;/node&gt;
                &lt;node label=&#8221;East&#8221;&gt;
                    &lt;node label=&#8221;Boston&#8221; /&gt;
                    &lt;node label=&#8221;New York&#8221; /&gt;
                    &lt;node label=&#8221;Toronto&#8221; /&gt;
                    &lt;node label=&#8221;Baltimore&#8221; /&gt;
                    &lt;node label=&#8221;Tampa Bay&#8221; /&gt;
                &lt;/node&gt;
            &lt;/node&gt;
            &lt;node label=&#8221;National League&#8221;&gt;
                &lt;node label=&#8221;West&#8221;&gt;
                    &lt;node label=&#8221;Arizona&#8221; /&gt;
                    &lt;node label=&#8221;Colorado&#8221; /&gt;
                    &lt;node label=&#8221;San Diego&#8221; /&gt;
                    &lt;node label=&#8221;Los Angeles&#8221; /&gt;
                    &lt;node label=&#8221;San Francisco&#8221; /&gt;
                &lt;/node&gt;
                &lt;node label=&#8221;Central&#8221;&gt;
                    &lt;node label=&#8221;Chicago&#8221; /&gt;
                    &lt;node label=&#8221;Milwaukee&#8221; /&gt;
                    &lt;node label=&#8221;St. Louis&#8221; /&gt;
                    &lt;node label=&#8221;Houston&#8221; /&gt;
                    &lt;node label=&#8221;Cincinnati&#8221; /&gt;
                    &lt;node label=&#8221;Pittsburgh&#8221; /&gt;
                &lt;/node&gt;
                &lt;node label=&#8221;East&#8221;&gt;
                    &lt;node label=&#8221;Philadelphia&#8221; /&gt;
                    &lt;node label=&#8221;New York&#8221; /&gt;
                    &lt;node label=&#8221;Atlanta&#8221; /&gt;
                    &lt;node label=&#8221;Washington&#8221; /&gt;
                    &lt;node label=&#8221;Florida&#8221; /&gt;
                &lt;/node&gt;
            &lt;/node&gt;
        &lt;/root&gt;
    &lt;/mx:XML&gt;

    &lt;mx:ApplicationControlBar dock=&#8221;true&#8221;&gt;
        &lt;mx:Button label=&#8221;Open all&#8221; click=&#8221;openAll();&#8221; /&gt;
        &lt;mx:Button label=&#8221;Close All&#8221; click=&#8221;closeAll();&#8221; /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Tree id=&#8221;tree&#8221;
            dataProvider=&#8221;{xmlDP}&#8221;
            labelField=&#8221;@label&#8221;
            showRoot=&#8221;false&#8221;
            width=&#8221;300&#8243;
            height=&#8221;100%&#8221;
            verticalScrollPolicy=&#8221;auto&#8221; /&gt;

&lt;/mx:Application&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luis</title>
		<link>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-6194</link>
		<author>Luis</author>
		<pubDate>Fri, 18 Jan 2008 09:31:28 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2008/01/15/expanding-nodes-in-a-flex-tree-control-using-the-openitems-property/#comment-6194</guid>
		<description>Hi Peter, Firt of all. Congratulations for the blog. It´s one of the best Fex Resources i found.

Lets talk about this post and see if you or other reader can help me. 

Imagine that my tree is embedded into a panel. (You can see my flex page about sanish accounting software in this comment link. Section "El Plan de Cuentas)

If i use your system to open all nodes, the content of the tree will go own from the content of the panl, but the panel is not showing me the scroll bar. Otherwise, expanding tree nodes 1 by 1 the panel show the scrolling bar when the size is not enough.

Thanks and great Job!</description>
		<content:encoded><![CDATA[<p>Hi Peter, Firt of all. Congratulations for the blog. It´s one of the best Fex Resources i found.</p>
<p>Lets talk about this post and see if you or other reader can help me. </p>
<p>Imagine that my tree is embedded into a panel. (You can see my flex page about sanish accounting software in this comment link. Section &#8220;El Plan de Cuentas)</p>
<p>If i use your system to open all nodes, the content of the tree will go own from the content of the panl, but the panel is not showing me the scroll bar. Otherwise, expanding tree nodes 1 by 1 the panel show the scrolling bar when the size is not enough.</p>
<p>Thanks and great Job!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
