I have a advanced data grid with columns as status, enabled, owner, name.
I will get data for status as 'applicable' or 'success' or 'failure' . When the status is coming as 'applicable', i have to show the tool tip when move the mouse over there. Can you please help me out how to do it?
You need to create a GridItemRenderer and here is some sample code to put within the script block of your custom GridItemRenderer:
import mx.controls.ToolTip;
import mx.core.IUIComponent;
import mx.managers.ToolTipManager;
public var applicableToolTip:ToolTip;
private function createToolTip(event:Event):void {
if (data["status"] == "applicable") {
var stagePoint:Point = event.target.localToGlobal(new Point(event.target.x, event.target.y));
applicableToolTip = ToolTipManager.createToolTip(
"Your applicable message here",
stagePoint.x,
stagePoint.y,
null,
IUIComponent(event.currentTarget)
) as ToolTip;
}
}
private function destroyToolTip(event : Event) : void {
if (applicableToolTip != null)
ToolTipManager.destroyToolTip(applicableToolTip);
}
Then in the label field within the renderer add the attributes rollOver="createToolTip(event)"
and rollOut="destroyToolTip(event)"
如果TooTip Manager
,则可以使用dataTip
函数构造消息,并将column的displayToolTip
属性设置为true
。
If your tooltip is inside your xml data you can specify dataTipField
on DataGridColumn
.
For example:
var col:DataGridColumn = new DataGridColumn();
col.dataTipField = "@statusTooltip";
col.showDataTips = true;
if your xml item looks something like:
<item id="..." status="applicable" statusTooltip="My tootlip text"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.