Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomatically display a toolTip in an ItemRenderer when the row is visible in the DataGrid
    primarykey
    data
    text
    <p>I have an <code>AdvancedDataGrid</code> that uses <code>HierarchicalData</code> to display data in a tree format. For one of the columns, I'm using an <code>AdvancedDataGridRendererProvider</code> to conditionally display an image if certain conditions are met. I'm currently using the <code>ToolTipManager</code> to display additional information if the user mouses over the image.</p> <p><strong>Here's what I would like to do:</strong></p> <p>Instead of showing the <code>toolTip</code> when the user places their mouse over the image, I would like to automatically display the <code>toolTip</code> whenever the image is visible in the <code>AdvancedDataGrid</code>. If the user scrolls through the <code>AdvancedDataGrid</code>, the <code>toolTip</code> should move and follow along with its image accordingly.</p> <p>Sample AdvancedDataGrid:</p> <pre><code>&lt;mx:AdvancedDataGrid id="myAdvancedDataGrid" displayItemsExpanded="true" allowMultipleSelection="false" dataProvider="{myTreeData}" draggableColumns="false" depthColors="{[0xD6E5FF,0xFFFFFF]}" folderClosedIcon="{null}" folderOpenIcon="{null}" defaultLeafIcon="{null}"&gt; &lt;mx:columns&gt; &lt;mx:AdvancedDataGridColumn id="colID" headerText="ID" dataField="myID"/&gt; &lt;mx:AdvancedDataGridColumn id="colComments" headerText="Comments" dataField="comments"/&gt; &lt;/mx:columns&gt; &lt;mx:rendererProviders&gt; &lt;mx:AdvancedDataGridRendererProvider column="{colComments}" depth="2" dataField="comments" renderer="com.whatever.AdvancedDataGridCommentsRenderer" /&gt; &lt;/mx:rendererProviders&gt; &lt;/mx:AdvancedDataGrid&gt; </code></pre> <p>And the current AdvancedDataGridRendererProvider:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" paddingLeft="2" paddingRight="2" paddingTop="2" horizontalScrollPolicy="off" verticalScrollPolicy="off" height="22" horizontalAlign="center"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.controls.ToolTip; import mx.events.FlexEvent; import mx.managers.ToolTipManager; [Embed(source="assets/myImage.png")] [Bindable] private var myIcon:Class; private var commentsToolTip:ToolTip; override public function set data(value:Object):void { super.data = value; if (value["comments"] != null) { if (value["comments"].toString().length &gt; 0) { myImage.visible = true; } else { myImage.visible = false; } } else { myImage.visible = false; } validateDisplayList(); } private function showToolTip(evt:Event, text:String):void { var pt:Point = new Point(evt.currentTarget.x, evt.currentTarget.y); // Convert the targets 'local' coordinates to 'global' -- this fixes the // tooltips positioning within containers. pt = evt.currentTarget.parent.contentToGlobal(pt); commentsToolTip = ToolTipManager.createToolTip(text, pt.x, pt.y, "errorTipAbove") as ToolTip; commentsToolTip.setStyle("borderColor", "#ff0000"); commentsToolTip.setStyle("color", "white"); var yOffset:int = commentsToolTip.height + 5; commentsToolTip.y -= yOffset; commentsToolTip.x -= 5; } // Remove the tooltip private function killToolTip():void { ToolTipManager.destroyToolTip(commentsToolTip); } ]]&gt; &lt;/fx:Script&gt; &lt;mx:Image id="myImage" source="{myIcon}" mouseOver="showToolTip(event, data['comments'].toString())" mouseOut="killToolTip()" /&gt; &lt;/mx:HBox&gt; </code></pre> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload