Hi All,

I coded like bellow, after refresh the dataprovider i need to open the
nodes upto before selected item,

but this is not working , if any one having idea please let me know.
it would be great

<?xml version="1.0" encoding="utf-8"?>
<mx:Tree xmlns:mx="http://www.adobe.com/2006/mxml"; render="renderFunc
()" >
        <mx:Script>
                <![CDATA[
                        import mx.events.TreeEvent;
                        import mx.events.FlexEvent;
                        import com.jpmc.wss.adr.frmwrk.collections.HashMap;
                        import mx.controls.Alert;
                        import
com.jpmc.wss.adr.instruction.common.constants.MaintenanceConstants;
                        import
com.jpmc.wss.adr.instruction.data.maintenance.messagecenter.MsgCenterInbndMsgRespItem;
                        import mx.collections.ArrayCollection;

                        import
com.jpmc.wss.adr.instruction.model.maintenance.messagecenter.MsgCenterInbndMsgModel;

                        private var msgCntrLeft:MessageCenterLeftMenu;
                        [Embed(source 
="../../../../../../../../../../../assets/common/
rootHome.png")]
                        [Bindable]
                public var rootSymbol:Class;
                [Embed(source ="../../../../../../../../../../../assets/
common/greenLeafWithArrow.png")]
                        [Bindable]
                public var greenSymbol:Class;
                [Embed(source ="../../../../../../../../../../../assets/
common/firstRootNode.png")]
                        [Bindable]
                public var msgSymbol:Class;
                [Embed(source ="../../../../../../../../../../../assets/
common/onlineUsers.png")]
                        [Bindable]
                public var WrkQueSymbol:Class;
                [Embed(source ="../../../../../../../../../../../assets/
common/onlineUsers1.png")]
                        [Bindable]
                public var WrkQueOffSymbol:Class;
                [Embed(source ="../../../../../../../../../../../assets/
common/user.png")]
                        [Bindable]
                public var userSymbol:Class;
                 private var _instanceMsg:MsgCenterInbndMsgModel =
MsgCenterInbndMsgModel.getInstance();
                private var parentHashMap:HashMap = new HashMap();
              //  public var tempOpen:ArrayCollection = new ArrayCollection
();
               private function expandParents
(node:MsgCenterInbndMsgRespItem):void {
                if ( node != null) {
                        parentHashMap.put(node.label,node);
                    expandParents(this.getParentItem(node));
                }
            }
            private function expandNodes():void{
                var objMsg:MsgCenterInbndMsgRespItem;
                var objArrKeys:Array = parentHashMap.getKeys() as Array;
                for(var i:int=objArrKeys.length;i>=0;i--)
                {
                         objMsg= parentHashMap.getValue(objArrKeys[i]) as
MsgCenterInbndMsgRespItem;
                                        if(objMsg != null){
                                        if(dataDescriptor.hasChildren(objMsg)){ 
                                                validateNow();
                                        expandItem(objMsg,true);
                                                }
                                         }
                }
            }
                private function renderFunc():void
                        {
                 if (_instanceMsg.refreshSO)
                                {
                                        _instanceMsg.refreshSO = false;
                                        expandParents(this.selectedItem as
MsgCenterInbndMsgRespItem);
                                }
                        }

                        private function setIcons():void {
                                var 
objMsgRespItemLevel1:MsgCenterInbndMsgRespItem;
                                var 
objMsgRespItemLevel2:MsgCenterInbndMsgRespItem;
                                var 
objMsgRespItemLevel3:MsgCenterInbndMsgRespItem;
                                var 
objMsgRespItemLevel4:MsgCenterInbndMsgRespItem;
                            var objMsgRespItemLevel5:MsgCenterInbndMsgRespItem;
                            var arrMsgInbndLevel1:ArrayCollection;
                            var arrMsgInbndLevel2:ArrayCollection;
                            var arrMsgInbndLevel3:ArrayCollection;
                            var arrMsgInbndLevel4:ArrayCollection;
                            var arrMsgInbndLevel5:ArrayCollection;
                            var indexLevel1:int;
                            var indexLevel2:int;
                            var indexLevel3:int;
                            var indexLevel4:int;
                            var indexLevel5:int;
                            //var isOpen:Boolean;
                            if(dataProvider != null){

                                arrMsgInbndLevel1 = dataProvider as 
ArrayCollection;

                                    for
(indexLevel1=0;indexLevel1<arrMsgInbndLevel1.length;indexLevel1++){
                                        objMsgRespItemLevel1 = 
arrMsgInbndLevel1.getItemAt
(indexLevel1) as MsgCenterInbndMsgRespItem;
                                        
this.setItemIcon(objMsgRespItemLevel1,rootSymbol,
rootSymbol);
                                        this.selectedIndex=0;
                                        this.setFocus();
                                        /* this.openItems=objMsgRespItemLevel1;
                                        
if(this.dataDescriptor.hasChildren(objMsgRespItemLevel1)){
                                                var isOpen:Boolean = 
this.isItemOpen(objMsgRespItemLevel1);
                                                
this.expandItem(objMsgRespItemLevel1, !isOpen);
                                        }
                                         */
                                        arrMsgInbndLevel2 = 
objMsgRespItemLevel1.children ;
                                        for(indexLevel2=0;
indexLevel2<arrMsgInbndLevel2.length;indexLevel2++){
                                                objMsgRespItemLevel2 = 
arrMsgInbndLevel2.getItemAt
(indexLevel2) as MsgCenterInbndMsgRespItem;
                                                
this.setItemIcon(objMsgRespItemLevel2,greenSymbol,
greenSymbol);
                                                
if(objMsgRespItemLevel2.strMsgSts ==
MaintenanceConstants.STR_DTC_MATCH)
                                                {
                                                        arrMsgInbndLevel3 = 
objMsgRespItemLevel2.children ;
                                                }
                                                else 
if(objMsgRespItemLevel2.strMsgSts ==
MaintenanceConstants.STR_SWIFT_MATCH)
                                                {
                                                        arrMsgInbndLevel3 = 
objMsgRespItemLevel2.children ;
                                                }
                                                for(indexLevel3=0; 
indexLevel3<arrMsgInbndLevel3.length;
indexLevel3++)
                                                {
                                                        objMsgRespItemLevel3 = 
arrMsgInbndLevel3.getItemAt
(indexLevel3) as MsgCenterInbndMsgRespItem;
                                                        
this.setItemIcon(objMsgRespItemLevel3,msgSymbol,
msgSymbol);
                                                        arrMsgInbndLevel4 = 
objMsgRespItemLevel3.children;
                                                        for(indexLevel4=0; 
indexLevel4<arrMsgInbndLevel4.length;
indexLevel4++)
                                                        {
                                                                
objMsgRespItemLevel4 = arrMsgInbndLevel4.getItemAt
(indexLevel4) as MsgCenterInbndMsgRespItem;
                                                                
arrMsgInbndLevel5 = objMsgRespItemLevel4.children;
                                                                
if(objMsgRespItemLevel4.intInGroup ==
MaintenanceConstants.INT_ZERO ){
                                                                        
this.setItemIcon(objMsgRespItemLevel4,WrkQueSymbol,
WrkQueSymbol);

                                                                }else 
if(objMsgRespItemLevel4.intInGroup ==
MaintenanceConstants.INT_ONE){
                                                                        
this.setItemIcon
(objMsgRespItemLevel4,WrkQueOffSymbol,WrkQueOffSymbol);
                                                                }
                                                                /* var 
strRowCount:String = String
(objMsgRespItemLevel4.intRowCount);
                                                                
while(strRowCount.length<=3)
                                                                {
                                                                        
strRowCount+=" ";
                                                                } */
                                                                
objMsgRespItemLevel4.label =
objMsgRespItemLevel4.intRowCount + "  " +
( objMsgRespItemLevel4.label);
                                                                
for(indexLevel5=0; indexLevel5<arrMsgInbndLevel5.length;
indexLevel5++)
                                                                {
                                                                        
objMsgRespItemLevel5 = arrMsgInbndLevel5.getItemAt
(indexLevel5) as MsgCenterInbndMsgRespItem;
                                                                        
objMsgRespItemLevel5.label =
objMsgRespItemLevel5.intRowCount + "  " + objMsgRespItemLevel5.label;
                                                                        
this.setItemIcon(arrMsgInbndLevel5.getItemAt
(indexLevel5),userSymbol, userSymbol);
                                                                }
                                                        }
                                                }
                                        }
                                    }
                            }


                 }

                        override public function set 
dataProvider(value:Object):void{
                                super.dataProvider = value;
                                setIcons();
                                expandNodes();
                        }
                ]]>
        </mx:Script>
</mx:Tree>


Please give me my mistake or other idea

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to