expandAll()

hi guys

I am using GroupingCollection.
when the screen loads i want to see all the data in expanded format but expandAll(); is not working

this.dataGrid.setStyle("folderClosedIcon", null);
this.dataGrid.setStyle("folderOpenIcon", null);
this.dataGrid.setStyle("defaultLeafIcon", null);                               
this.dataGrid.expandAll();  -- not displaying the data in expanded format.

any idea?

thanks
royjaydAsked:
Who is Participating?
 
dgofmanConnect With a Mentor Commented:
You may need execute expandAll after data loaded add event listener in datagrid

<mx:Script>
        <![CDATA[
            import mx.events.CollectionEvent;
            
            protected function initHandler(event:Event):void
            {
                var dg:AdvancedDataGrid = event.target as AdvancedDataGrid;
                function expandAll(event:CollectionEvent):void{
                    dg.expandAll();
                };
                dg.addEventListener(CollectionEvent.COLLECTION_CHANGE, expandAll);
                if(dg.dataProvider != null)
                    dg.expandAll();
                
                //test
                //dg.dataProvider = [{col:1},{col:2},{col:3},{col:4}];
            }
        ]]>
    </mx:Script>
   <mx:AdvancedDataGrid preinitialize="initHandler(event)">

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.