0 Replies Latest reply on Mar 6, 2008 6:07 AM by ArunMarella

    Problem with Refreshing multiple tree grids

    ArunMarella
      Hi ,
      Iam facing a strange problem while refreshing multiple tree data grids(flex 3.0) present in a single split panel.

      I am initializing the tree grids using XML stream coming from a servlet. From the XML stream, Iam creating an XMLListCollection and then an HierarchicalData. This HierarchicalData is assigned as data provider to the tree grid.

      This, I have done for both the tree grids(two different HierarchicalData and XMLListCollection ). Now, the problem is that, when Iam refreshing one tree data grid, the other is also getting refreshed.

      Please suggest how to solve this problem. I am attaching the code below.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="init()">

      <mx:Script>
      <![CDATA[
      import com.utils.Util;
      import mx.binding.utils.BindingUtils;
      import mx.collections.XMLListCollection;
      import mx.collections.ArrayCollection;
      import mx.controls.Alert;
      import mx.collections.HierarchicalData;
      import mx.rpc.events.ResultEvent;




      private var OGDInvalidXMLListCollection:XMLListCollection;
      private var OGDValidXMLListCollection:XMLListCollection;

      private var util:Util=new Util;

      private var OGDColumnsArrayCollection:ArrayCollection;





      [Bindable]
      private var OGDValidHierarchicalData:HierarchicalData;
      [Bindable]
      private var OGDInvalidHierarchicalData:HierarchicalData;





      public function init():void{
      metadata.send();
      initialdata.send();

      var delay:Number = (Math.round((Math.random()*10)+2))*1000;
      var minuteTimer:Timer = new Timer((delay+1000),1);
      minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
      minuteTimer.start();


      }

      private function onTick(evt:TimerEvent):void{
      deltadata.send();
      }

      private function onMetaData(event:ResultEvent):void{
      OGDColumnsArrayCollection=event.result.tags.Ogd.tagdetail;
      dg3.columns=util.createColumns(STDColumnsArrayCollection);
      dg4.columns=util.createColumns(STDColumnsArrayCollection);
      }
      private function onInitialData(event:ResultEvent):void{
      var initialTradeXml:XML=event.result as XML;
      var filteredTrades:Array;

      filteredTrades=util.filterValidInvalidTrades(initialTradeXml.ogd);

      filteredTrades=util.filterValidInvalidTrades(initialTradeXml.ogd);
      OGDValidXMLListCollection=new XMLListCollection(filteredTrades[0]);
      OGDValidHierarchicalData=new HierarchicalData(OGDValidXMLListCollection);
      OGDInvalidXMLListCollection=new XMLListCollection(filteredTrades[1]);
      OGDInvalidHierarchicalData=new HierarchicalData(OGDInvalidXMLListCollection);


      }
      private function onDeltaData(event:ResultEvent):void{
      var deltaTradeXml:XML=event.result as XML;
      var filteredTrades1:Array;
      filteredTrades1=util.filterValidInvalidTrades(deltaTradeXml.std);
      util.updateDeltaTrades(OGDInvalidXMLListCollection,filteredTrades1[1]);
      util.updateDeltaTrades(OGDValidXMLListCollection,filteredTrades1[0]);

      }




      ]]>
      </mx:Script>

      <mx:HTTPService id="metadata" url="Data/MetaData.xml" result="onMetaData(event)"/>
      <mx:HTTPService id="initialdata" url="Data/Trades.xml" result="onInitialData(event)" resultFormat="e4x"/>
      <mx:HTTPService id="deltadata" url="Data/DeltaTrades.xml" result="onDeltaData(event)" resultFormat="e4x"/>
      <!--mx:XML id="trades" source="Data/InitialTrades.xml"/-->


      <mx:TabNavigator x="0" y="0" width="100%" height="100%">
      <mx:Canvas label="OGD Confirmation" width="100%" height="100%" creationComplete="create('OGD')">
      <mx:VDividedBox x="0" y="0" height="100%" width="100%" borderStyle="solid">
      <mx:Canvas width="100%" height="100%">
      <mx:Label x="0" y="0" text="Exception Trades" width="100%"/>
      <mx:AdvancedDataGrid id="dg3" x="0" y="26" width="100%" height="100%" dataProvider="{OGDInvalidHierarchicalData}" >
      </mx:AdvancedDataGrid>
      </mx:Canvas>
      <mx:Canvas id="cnDg2" name="cnDg2" width="100%" height="100%">
      <mx:Label x="0" y="0" text="In Progress Trades" width="100%"/>
      <mx:AdvancedDataGrid id="dg4" x="0" y="26" width="100%" height="100%" dataProvider="{OGDValidHierarchicalData}" >
      </mx:AdvancedDataGrid>
      </mx:Canvas>
      </mx:VDividedBox>
      </mx:Canvas>

      </mx:TabNavigator>
      </mx:Application>