Flex, a mx:Tree component in Spark application, the scrollbar auto send to top when collapsed a tree node
Flex, a mx:Tree in Spark application, the scrollbar will move to top when i collapsed a tree node, the test code as follows:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="init()">
<fx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
[Bindable]
private var treeData:XML =
<node label='root'>
<node label="Monkeys">
<node label="South America">
<node label="Coastal"/>
<node label="Inland"/>
</node>
<node label="Africa" isBranch="true">
<node label="Coastal"/>
<node label="Inland"/>
</node>
<node label="Asia" isBranch="true">
<node label="Coastal"/>
<node label="Inland"/>
</node>
</node>
<node label="Sharks">
<node label="South America" isBranch="true">
<node label="Coastal"/>
<node label="Inland"/>
</node>
<node label="Africa" isBranch="true">
<node label="Coastal"/>
<node label="Inland"/>
</node>
<node label="Asia" >
<node label="Coastal"/>
<node label="Inland"/>
</node>
</node>
</node>;
private function init():void{
myTree.expandChildrenOf(myTree.firstVisibleItem, true);
}
]]>
<开发者_运维技巧;/fx:Script>
<mx:Tree id="myTree"
y="50"
width="221"
height="207"
horizontalCenter="0"
dataProvider="{treeData.node}"
labelField="@label"/>
</s:Application>
There are a lot of amazing issues with MX Tree e.g. try horizontal tree scrolling when item icons are shown.
I suggest you to consider migrating to an open-source custom component called Spark Tree.
精彩评论