Last active
December 17, 2015 17:09
-
-
Save simion314/5643744 to your computer and use it in GitHub Desktop.
Flex Tree ,change the dataProvider but keep selectin and open items if possible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override function set dataProvider(value:Object):void | |
{ | |
if(this.dataProvider==null) | |
super.dataProvider=value; | |
else{ | |
//want to keep the opened categories | |
var fcarr:ArrayCollection=value as ArrayCollection; | |
var openItems:Array=this.openItems as Array; | |
var itemToOpen:Array=[]; | |
for each (var it:FeedCategory in openItems) { | |
for each (var fc:FeedCategory in fcarr) | |
{ | |
if(it.title==fc.title) | |
itemToOpen.push(fc); | |
} | |
} | |
super.dataProvider=value; | |
this.openItems=itemToOpen; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment