Select to view content in your preferred language

InfoWindow title text via ItemRenderer

583
1
03-18-2011 07:52 AM
ReneRubalcava
Esri Frequent Contributor
I am trying to set the InfoWindow title via my ItemRenderer that I am assigning to a FeatureLayer.
I can set the title from the map.infoWindow.label, but my ItemRenderer doesn't have access to the map and the title will vary among FeatureLayers.

All the samples are still using mx comps with inline ItemRenderers. Spark containers don't have a label field and mine are set up from ClassFactory in AS3. I tried setting the ItemRenderer label (label="{data.Type}"), but that doesn't seem to get reflected in the InfoWindow.

Do I need to extend the InfoWindow to add this or is there a simpler method of setting the InfoWindow title?

For example, here is my ItemRenderer that is assigned to one Featurelayer.
Can I set the InfoWindow title from this ItemRenderer?
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    autoDrawBackground="false"
    label="{data.Type}">
 <fx:Script>
  <![CDATA[
   override public function set data(value:Object):void
   {
    super.data = value;
    // TODO - calc lat/longs, parse img data
    lblCost.text = stringValue(value.COSTINFO)
    lblLease.text = stringValue(value.LEASEINFO);
    lblLease2.text = stringValue(value.LEASEINFO2);
    lblMeter.text = stringValue(value.METERINFO);
    lblElec.text = stringValue(value.ELECTRICAL);
   }
   
   private function stringValue(value:String):String
   {
    return (value.length > 1) ? value : "None";
   }
  ]]>
 </fx:Script>
 <s:Group id="grpMain"
    width="100%"
    height="100%">
  <s:layout>
   <s:HorizontalLayout gap="8"
        paddingBottom="5"
        paddingLeft="5"
        paddingRight="5"
        paddingTop="5" />
  </s:layout>
  <s:Group id="fieldNames">
   <s:layout>
    <s:VerticalLayout gap="2" />
   </s:layout>
   <s:Label text="Lat:" />
   <s:Label text="Long:" />
   <s:Label text="Image: " />
   <s:Label text="Cost Info:" />
   <s:Label text="Lease Info:" />
   <s:Label text="More Lease Info:" />
   <s:Label text="Meter Info:" />
   <s:Label text="Electrical Info:" />
  </s:Group>
  <s:Group id="fieldValues">
   <s:layout>
    <s:VerticalLayout gap="2" />
   </s:layout>
   <s:Label id="lblLat" />
   <s:Label id="lblLong" />
   <s:Label id="lblImage" />
   <s:Label id="lblCost" />
   <s:Label id="lblLease" />
   <s:Label id="lblLease2" />
   <s:Label id="lblMeter" />
   <s:Label id="lblElec" />
  </s:Group>
 </s:Group>
</s:ItemRenderer>
Tags (2)
0 Kudos
1 Reply
ReneRubalcava
Esri Frequent Contributor
Well, not really ideal, but I fixed this by changing the s:ItemRenderer to a mx:Canvas.
I'd prefer to not mix halo/spark, but it works as long as I remember to check that spark comps have been created.
0 Kudos