Skip to content

Instantly share code, notes, and snippets.

@simion314
Last active December 17, 2015 17:09
Show Gist options
  • Save simion314/5643744 to your computer and use it in GitHub Desktop.
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
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