3 Replies Latest reply on Oct 5, 2012 10:06 AM by Flex harUI

    HTTPService retrieves no data within itemrenderere

    core009 Level 1

      I have an Horizontal list that is connected to "patients" arraycollection.   I've created an Canvas Itemrenderer for the horizontal list that lists the patient's medical information. 

       

       

      Within the itemrenderer, I am calling out to a PHP HTTPService call to retrieve the visits for each patient.   However I am not getting any data returned.   

       

       

      If I run the HTTPService in the main application, it works.

      itemrenderer.JPG

       

      My main app code below:

       

       

      <mx:HorizontalList id="h_compare" width="100%" height="100%" dataProvider="{myCompare}" labelField="name" itemRenderer="comparerenderer" columnWidth="500"

      rowHeight="{hbox_compare.height}" borderColor="haloBlue" scrollTipFunction="horizontalList_scrollTipFunc" showScrollTips="true"                                                                                  alternatingItemColors="[#FFFFFF, #EEEEEE]" backgroundAlpha=".5" removedEffect="{fadeOut}"/>

       

       

      Itemrenderer code below  (Screenshot also attached).

       

      <?xml version="1.0" encoding="utf-8"?>

      <!-- http://blog.flexexamples.com/2008/03/08/creating-a -simple-image-gallery-with-the-flex-tilelist-contr ol/ -->

      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"

      horizontalAlign="center"

      verticalAlign="middle" xmlns:flexiframe="http://code.google.com/p/flex-i frame/"

      width="100%" height="100%" backgroundColor="#DBD8CC" preinitialize="srv_visit_rend.send();" xmlns:creativesource="it.creativesour

      ce.*">

       

      <m x:Script>

      <![CDATA[

      import mx.rpc.events.FaultEvent;

      import mx.rpc.events.ResultEvent;

      import mx.collections.ArrayCollection;

      import com.adobe.serialization.json.JSON;

      import mx.controls.Alert;

       

      public function initapp():void

      {

      //parentDocument.get_user(data .patient_id.toString());

      srv_visit_rend.send();

      }

       

      [Bindable]

      var myVisits_rend:ArrayCollection;

       

      private function resultHandler_visit_rend(e:ResultEvent):void

      {

      // myData.source = ArrayCollection(e.result.data.row).toArray();

      var sample:String = data.patient_id;

       

      var rawArray:Array;

      var rawData:String = String(e.result);

      rawArray = JSON.decode(rawData) as Array;

       

      myVisits_rend = new ArrayCollection(rawArray);

      myVisits_rend.refresh( );

      }

       

      private function handle(e:Event):void{

      parentDocument.alert_parent _remove_panel(data);

      //Alert.show('Hello from the titleBar Button!!');

      }

       

       

      ]]>

      </mx:Script>

       

      <mx:HTTPServic e id="srv_visit_rend" url="http://localhost/test_visit.php"

      result="resultHandler_visit_rend(event)"

      showBusyCursor="true">

      <mx:request xmlns="">

      <patient_id>

      {data.patient_id}

      </patient_id>

      </mx:request>

      </mx:HTTPService>

       

      <creativesource :CustomPanel width="100%" height="100%"

      titleBtnClick="{handle(event)}">

       

       

      <mx:HBox width="100%" height="30%">

      <mx:Panel width="100%" height="100%" alpha="1.0" headerHeight="0" backgroundAlpha="0" borderStyle="none">

      <mx:VBox width="100%" height="100%">

      <mx:Label text="{data.patient_id}" fontAntiAliasType="advanced" fontSize="20" fontWeight="bold"/>

      <mx:Label text="{data.diagnosis}" fontAntiAliasType="advanced" fontSize="20" fontWeight="bold"/>

      <mx:TextInput id="lname" width="100%" text="{data.name}"/>

      <mx:TextInput id="city" text="{data.Eitology}"/>

      <mx:TextInput id="zip" width="100%" text="{data.cause_of_injury}"/>

      <mx:TextInput width="100%" text="{data.cortical_injury}"/>

      <mx:TextInput width="100%" text="{data.thalamic_injury}"/>

      </mx:VBox>

       

      </mx :Panel>

      </mx:HBox>

      <mx:HBox width="100%" height="70%">

      <mx:VBox width="10%" height="100%">

      <mx:DataGrid width="100%" height="100%" dataProvider="{myVisits_rend}">

      <mx:columns>

       

       

      <mx :DataGridColumn headerText="Visit" dataField="visit_start_date" width="20" color="#333333"/>

      </mx:columns>

      </mx:DataGrid>

      </mx:VBox>

      <mx:VBox width="90%" height="100%">

      <mx:TabNavigator width="100%" height="100%">

      <mx:Canvas width="100%" height="100%" label="Summary">

      </mx:Canvas>

      <mx:Canvas width="100%" height="100%" label="Imaging">

      <flexiframe:IFrame id="slowLoadingIFrameWithLoadIndicator"

      source="http://ric.uthscsa.edu/mango/MangoUsingLo ader.html"

      loadIndicatorClass="SampleLoadIndicator"

      width="100%"

      height="100%"/>

      </mx:Canvas>

      <mx:Canvas width="100%" height="100%" label="File Directory">

      <mx:DataGrid dataProvider="" width="100%" height="100%">

      <mx:columns>

      <mx:DataGridColumn dataField="length" headerText="Files/Folders" width="100">

      <mx:itemRenderer>

      <mx:Component>

      <mx :LinkButton label="" click=""

      fontWeight="normal"/>

      </mx:Component>

      </mx:itemRe nderer>

      </mx:DataGridColumn>

      </mx:columns>

      </mx: DataGrid>

      </mx:Canvas>

      <mx:Canvas width="100%" height="100%" label="Audit">

      </mx:Canvas>

      </mx:TabNavigator>

      </ mx:VBox>

      </mx:HBox>

      </creativesource:CustomPanel >

      </mx:VBox>