We can use Spark DataGrid's showDataTips and dataTipFunction properties to show customized tool tips on the rows.
An example showing this:
An example showing this:
<?xml version="1.0" encoding="utf-8"?> <s:Application initialize="onInitialize()" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.utils.StringUtil; private static function fnDataTip(item:Object, column:GridColumn):String { var toolTip:String = item[column.dataTipField != null ? column.dataTipField : column.dataField]; if (toolTip == null || StringUtil.trim(toolTip) == "") toolTip = ""; if (item.hasOwnProperty("toolTipComment") && item.toolTipComment != null && item.toolTipComment.length > 0) return (toolTip == "") ? item.toolTipComment : (toolTip + "\n" + item.toolTipComment); else return toolTip; } [Bindable] private var acDataProvider:ArrayCollection = new ArrayCollection(); private function onInitialize():void { acDataProvider.addItem({ code: "A", value: "10" }); acDataProvider.addItem({ code: "B", value: "20", toolTipComment: "ToolTip comment" }); } ]]> </fx:Script> <s:DataGrid dataProvider="{acDataProvider}" showDataTips="true" dataTipFunction="fnDataTip"> <s:columns> <s:ArrayList> <s:GridColumn dataField="code" headerText="Code"/> <s:GridColumn dataField="value" headerText="Value"/> </s:ArrayList> </s:columns> </s:DataGrid> </s:Application>
Comments