Skip navigation
Ameya Mogare
Currently Being Moderated

Unable to receive ArrayCollection Data in Custom Tooltip

Apr 13, 2011 10:33 PM

Hi,

 

I have developed a custom tooltip component as follows: -

 

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
    implements="mx.core.IToolTip" width="400" height="300"
    backgroundColor="#FFF8C6"
    cornerRadius="10" horizontalAlign="center" paddingTop="10">
<mx:Script>
    <![CDATA[
        [Bindable]
        public var arrayCol:Object;
        [Bindable]
        public var hdrText:String;

        //  Implement required methods of the IToolTip interface;

 

        //  these methods are not used in this example, though.
        public var _text:String;
        public function get text():String {
            return _text;
        }
        public function set text(value:String):void {
        }
    ]]>
</mx:Script>

    <mx:Text text="{hdrText}" width="100%" textAlign="left" fontWeight="bold"/>

 

    <mx:DataGrid dataProvider="{arrayCol}" width="100%" editable="false" backgroundColor="#FFF8C6"
                 verticalGridLines="false" horizontalGridLines="false"
                 textAlign="left" showHeaders="false" verticalScrollPolicy="off" horizontalScrollPolicy="off"
                 fontSize="10" color="#000000" rowCount="-1"
                 />
</mx:VBox>

 

And I am calling it on a Repeater's Text UI components as follows: -

 

In script: -

            private function createCustomToolTip(event:ToolTipEvent, item:Object):void {
               
                var toolTip:SkillCustomTooltip = new SkillCustomTooltip();
                var cName : String = item.getRepeaterItem().sgname;
                toolTip.hdrText = cName;
               
                if(cName == "Activities"){
                    toolTip.arrayCol = Activities;
                }else if(cName == "Business Processes"){
                    toolTip.arrayCol = BusinessPro;
                }else if(cName == "Industries"){
                    toolTip.arrayCol = Industr;
                }else if(cName == "Language"){
                    toolTip.arrayCol = Languages;
                }else if(cName == "Methods and Standards"){
                    toolTip.arrayCol = MedStands;
                }else if(cName == "Offerings"){
                    toolTip.arrayCol = Offerings;
                }else if(cName == "Products"){
                    toolTip.arrayCol = Products;
                }
                event.toolTip = toolTip;
            }

 

In mxml : -

<mx:Repeater id="rptSkillGroups" dataProvider="{SkillGroups}">
     <mx:LinkButton label="{rptSkillGroups.currentItem.sgname}"
                                      color="#0095A7" fontWeight="bold" textAlign="left" 
                                      toolTip=" "
                                      toolTipCreate="createCustomToolTip(event, event.currentTarget)"/>
</mx:Repeater>

 

But at runtime, my datagrid in custom tooltip is empty.

 

Note:

1. all arraycollections that inside if/else blocks above are single column arraycollections with different column names.

2. arraycollections are mapped to WD context nodes with valid data.

 

Please help.

 

Thanks and regards,

Amey

 
Replies
  • Currently Being Moderated
    Apr 13, 2011 11:00 PM   in reply to Ameya Mogare

    I would think you would need some code in the text setter.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 14, 2011 7:13 AM   in reply to Ameya Mogare

    What Flex harUi means your text-setter property of your custom tooltip component is simply empty. But that seems not to be the problem.

     

    This row is the issue:

    var cName : String = item.getRepeaterItem().sgname;

    and

    createCustomToolTip(event, event.currentTarget)

     

    It would be easier if you send simply the text over the createCustomTooltip handler.

     

    createCustomToolTip(event, rptSkillGroups.currentItem.sgname)

     

    The you can simply set the toolip depending on the current data item.

     

    var cName:String = item as String (cast is only necessary for the object of course)

     

    This could also be done with more complex data.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 14, 2011 11:10 AM   in reply to Ameya Mogare

    I believe the toolTip property is assigned as the text to the IToolTip

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points