I’ve just updated the Spark Tree custom component. Here are the improvements and new features.
- Code is optimized and runs smoothly even on 1000 and more elements
iconFunction:Function
propertyiconField:String
propertyiconOpenField:String
propertyfolderOpenIcon
stylefolderClosedIcon
styledefaultLeafIcon
styletextRollOverColor
styletextSelectedColor
style
On the first glance, your implementation looks very good.
Relying on mx.controls.treeClasses.DefaultDataDescriptor, that was cool.
If your project is currently under development, I suggest to move your code to GitHub, may be you will gain some contributions… someday )
Thanks ;)
Hi,
Your component seem very interresting. Unfortunatly, it doesn’t seem implement the “openitems” property as the mx tree do.
Is there a way to do it easily ?
Thanks
Dear Julien,
Thank you. The best way to get open nodes is:
1. Get Spark Tree source code
2. Open file
TreeDataProvider.as
3. Make
openedBranchesVector
orparentObjectsToOpenedBranches
publicly accessible by changing their scope or adding a getter.4. Get them via
TreeDataProvider(tree.dataProvider).openedBranchesVector
Hi,
I’m trying to get the SparkTree working with Flex 4.6?
Could you give me an advice how to do that?
Many Thanks,
Stefan
Hi Stefan!
Thank you for using Spark Tree. Try downloading https://github.com/downloads/kachurovskiy/Spark-Tree/SparkTree4.5.swc . I haven’t tested it with 4.6 yet, need to download new Builder and SDK and it takes a while.
Hey there – at the moment, the tree automatically closes all child branches when closing a branch. Is it possible to prevent this?
Many thanks – Kim
Hi Kim! The only way you can do this is get the library source and modify it.
P.S: You may have problems with memory leaks in this case if you will store links to open branches. You will need some hash-function or node ID.
Ha – There goes my hope for an easy fix!
Will let you know how I get on :)
Btw – have noticed an issue with using
virtualLayout
anditemRenderer
recycling.If a selected item is scrolled out of view, when it is scrolled back into view it re-dispatches the
ITEM_SELECTED
event.I’ve fixed this by using
useVirtualLayout=false
when adding the component to my project, but maybe there’s a better way.Cheers – Kim
Spark List does not have
ITEM_SELECTED
event. The closes event I can imagine isCHANGE
, but it does not arrive twice if you scroll selected item out and in.I strongly discourage the use of
useVirtualLayout=false
because it will cause performance problems when list data size increase.If you can reproduce this bug on an empty project I will be glad to help you. Cheers!
That explains a lot.. I’m working with an existing code base, so I assumed all the classes I had were part of the original SparkTree code.
Apologies for the confusion. My tree implementation will probably max out at around 30 items, so it’s not a big issue for now.
Thanks for taking the time to answer all my queries though :)
Kim