Flex: Tree component: keeping state when data provider updates
问题 How would I go about keeping the state of a tree control? I'd like to keep the state of the tree when it's data provider gets updated, instead of it collapsing. 回答1: How about something like this : var openItems:Object = tree.openItems; tree.dataProvider = myNewDataProvider; tree.openItems = openItems; tree.validateNow(); I'm not sure how well this will work if the new dataProvider is radically different from the old one, but it works when you're lazy loading tree nodes. 回答2: Here is how I