3 Replies Latest reply on Nov 6, 2008 12:07 PM by ice9_us

    DataPassing to AdvDataGrd

    ice9_us Level 1
      http://genesis.dvrdns.org/flex/test/test.html

      I have a data grid to select a host...
      When that host is selected.. i sort through some data... to make a xmllistcollection which is to be displayed in the data grid..

      Thanks in advanced for any help.
        • 1. Re: DataPassing to AdvDataGrd
          Gregory Lafrance Level 6
          You need to give us some more information on what you are trying to do, how you are currently doing it, and preferrably simple yet "complete" sample code with a simple data set.
          • 2. Re: DataPassing to AdvDataGrd
            ice9_us Level 1
            when i click on the names in the 1 data grid..
            i want shorted data in the array to be displayed in the 2nd data grid..




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

            <mx:Script>
            <![CDATA[
            XML.ignoreComments=false;
            XML.ignoreProcessingInstructions=false;
            import mx.charts.series.LineSeries;
            import mx.collections.*;
            import mx.controls.Alert;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.charts.*;




            public function init():void {
            getChartData.send();
            }

            [Bindable]
            public var myServerStatDataKstat:XMLListCollection = new XMLListCollection();
            [Bindable]
            public var myServStatResultProcStat:XMLListCollection = new XMLListCollection();
            [Bindable]
            public var serverList:Array = new Array();
            [Bindable]
            public var myServLstCollect:ArrayCollection = new ArrayCollection();
            [Bindable]
            public var MyServList:XMLList = new XMLList();
            [Bindable]
            public var MyServConfResultProcStat:XMLList = new XMLList();
            [Bindable]
            public var MyServConfResultKstat:XMLList = new XMLList();
            [Bindable]
            public var list_myArray:Array = new Array(new Array, new Array);
            public function hndleConfigBoxData(event:ResultEvent):void {


            MyServConfResultKstat = event.result.server_stats.kstat;
            MyServConfResultProcStat = event.result.server_stats.process_stats;
            MyServList = event.result.host;

            //myServerStatDataKstat.source = MyServConfResultKstat;
            //myServStatResultProcStat.source = MyServConfResultProcStat
            /* for ( var i:Number = 0; MyServList != null ; i++ ) {
            serverList
            = MyServList .@name.toString();
            }
            */



            }
            [Bindable]
            public var selServ:String = new String();
            [Bindable]
            public var MySelDataKstat:Array = new Array();
            [Bindable]
            public var MySelDataProcStat:XMLListCollection = new XMLListCollection();
            public function showGraph(event:Event):void {
            selServ = event.currentTarget.selectedItem.@name;

            for ( var i:Number = 0; i < myServerStatDataKstat.length; i++ ) {
            if ( myServerStatDataKstat
            .@server == selServ ) {
            //trace(myServerStatDataKstat .*);
            }
            }

            for ( i = 0; MyServConfResultProcStat
            != null ; i++ ) {
            trace(selServ);
            if ( MyServConfResultProcStat .@server == selServ ) {
            MySelDataKstat.push(MyServConfResultProcStat
            .proc_pid);
            trace(MyServConfResultProcStat .@server);
            MySelDataKstat.refresh();
            }
            }


            }


            public function faultHandler(event:FaultEvent):void {
            Alert.show(event.fault.faultString, event.fault.faultCode);
            }
            ]]>
            </mx:Script>


            <mx:HTTPService id="getChartData" url=" http://genesis.dvrdns.org/flex/cgi-bin/list_graph_data.cgi"
            method="GET" result="hndleConfigBoxData(event)" fault="faultHandler(event)" resultFormat="e4x" />


            <mx:AdvancedDataGrid x="20" y="10" id="serverlist" dataProvider="{MyServList}" click="showGraph(event)" />
            <mx:AdvancedDataGrid x="188" y="10" id="myDataList" dataProvider="{MySelDataKstat}" designViewDataType="flat" >
            <mx:columns>
            <mx:AdvancedDataGridColumn dataField="*"/>

            </mx:columns>
            </mx:AdvancedDataGrid>




            </mx:Application>
            • 3. Re: DataPassing to AdvDataGrd
              ice9_us Level 1
              k.. i have it working "Some what.."
              but the data is all on one line.. not in columns

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

              <mx:Script>
              <![CDATA[
              XML.ignoreComments=false;
              XML.ignoreProcessingInstructions=false;
              import mx.charts.series.LineSeries;
              import mx.collections.*;
              import mx.controls.Alert;
              import mx.rpc.events.FaultEvent;
              import mx.rpc.events.ResultEvent;
              import mx.charts.*;




              public function init():void {
              getChartData.send();
              }

              [Bindable]
              public var myServerStatDataKstat:XMLListCollection = new XMLListCollection();
              [Bindable]
              public var myServStatResultProcStat:XMLListCollection = new XMLListCollection();
              [Bindable]
              public var serverList:Array = new Array();
              [Bindable]
              public var myServLstCollect:ArrayCollection = new ArrayCollection();
              [Bindable]
              public var MyServList:XMLList = new XMLList();
              [Bindable]
              public var MyServConfResultProcStat:XMLList = new XMLList();
              [Bindable]
              public var MyServConfResultKstat:XMLList = new XMLList();
              [Bindable]
              public var list_myArray:Array = new Array(new Array, new Array);
              public function hndleConfigBoxData(event:ResultEvent):void {


              MyServConfResultKstat = event.result.server_stats.kstat;
              MyServConfResultProcStat = event.result.server_stats.process_stats;
              MyServList = event.result.host;

              //myServerStatDataKstat.source = MyServConfResultKstat;
              //myServStatResultProcStat.source = MyServConfResultProcStat
              /* for ( var i:Number = 0; MyServList != null ; i++ ) {
              serverList
              = MyServList .@name.toString();
              }
              */



              }
              [Bindable]
              public var selServ:String = new String();
              [Bindable]
              public var MySelDataKstat:Array = new Array();
              [Bindable]
              public var MySelDataKstatStat:ArrayCollection = new ArrayCollection();
              [Bindable]
              public var MySelDataProcStat:XMLListCollection = new XMLListCollection();
              public function showGraph(event:Event):void {
              selServ = event.currentTarget.selectedItem.@name;

              for ( var i:Number = 0; i < myServerStatDataKstat.length; i++ ) {
              if ( myServerStatDataKstat
              .@server == selServ ) {
              //trace(myServerStatDataKstat .*);
              }
              }

              for ( i = 0; MyServConfResultProcStat
              != null ; i++ ) {
              trace(selServ);
              if ( MyServConfResultProcStat .@server == selServ ) {
              MySelDataKstatStat.source.push(MyServConfResultProcStat
              .proc_pid);

              }
              }


              }


              public function faultHandler(event:FaultEvent):void {
              Alert.show(event.fault.faultString, event.fault.faultCode);
              }
              ]]>
              </mx:Script>


              <mx:HTTPService id="getChartData" url=" http://genesis.dvrdns.org/flex/cgi-bin/list_graph_data.cgi"
              method="GET" result="hndleConfigBoxData(event)" fault="faultHandler(event)" resultFormat="e4x" />


              <mx:AdvancedDataGrid x="20" y="10" id="serverlist" dataProvider="{MyServList}" click="showGraph(event)" />
              <mx:AdvancedDataGrid x="188" y="10" id="myDataList" dataProvider="{MySelDataKstatStat}" designViewDataType="tree" >
              <mx:columns>
              <mx:AdvancedDataGridColumn dataField="@pid"/>
              </mx:columns>

              </mx:AdvancedDataGrid>




              </mx:Application>