How do I force all Tree itemrenderers to refresh?

I have item renderers in an mx.controls.Tree that I need to refresh on demand.

I have code in the updateDisplayList that fires for only some of the visible nodes no matter what I do. I've tried triggering a change that they should all be listening for; I have tried clearing and resetting the dataProvider and the itemRenderer properties.

        private function forceCategoryTreeRefresh(event : Event = null) : void

            var prevDataProvider : Object = CategoryTree.dataProvider;
            CategoryTree.dataProvider = null;
            CategoryTree.dataProvider = prevDataProvider;

            var prevItemRenderer : IFactory = CategoryTree.itemRenderer;
            CategoryTree.itemRenderer = null;

            CategoryTree.itemRenderer = prevItemRenderer as IFactory;

            _categoriesChangeDispatcher.dispatchEvent(new Event(Event.CHANGE));

The nodes refresh properly when I scroll them into view (e.g. the .data gets set), but I cannot force the ones that already exist to refresh or reset themselves.

Any ideas?


Try calling this function on change event:

private function refreshList(e:Event):void{

for me work quite well

Try treeView.dataProvider = treeView.dataProvider;

That should update Tree view.

ItemRenderers in Flex are virtualized so there will not always be one ItemRenderer for each Tree node.

However, you can invalidate the nodes to force a refresh. The answer to this question gives an example of how to do that.

Need Your Help

Zend framework 2 REST API : set Request parameters

php zend-framework zend-framework2 zend-rest

I am new to PHP frameworks and building REST API on Zend Framework 2. I want to add params to Request. I could not find method to add params so I'll do it by getting all params then, adding new par...

Get user object inside an entity

php symfony fosuserbundle pugxmultiuserbundle

I'm trying to get user object inside an entity. I'm using FosUserBundle and PugxMultiUserBundle, and I tried the following command: