开发者

inline formatting of a tooltip of an itemrenderer of a datagrid?

开发者 https://www.devze.com 2023-01-10 17:56 出处:网络
How to style parts of the tooltip e.g. bold? I’m generating a tooltip in an itemrenderer for an datagrid, displaying the column name and then the value: I want to display the value bold…

How to style parts of the tooltip e.g. bold? I’m generating a tooltip in an itemrenderer for an datagrid, displaying the column name and then the value: I want to display the value bold…

    public override function set data(value:Object):void
{
var dg:DataGrid = this.listData.owner as DataGrid;
var dataField:String = (dg.columns[this.listData.columnIndex] as DataGridColumn).dataField;

var toolString:String = “”;
for(var i:int = 0; i < dg.columns.length; i++)
{
var fieldName:String = (dg.columns[i] as DataGridColumn).dataField;
toolString = StringUtil.substitute("{0}{1}: {2}\n", toolString, fieldName, displayString(value[fieldN开发者_StackOverflowame]));
}
this.toolTip = toolString;

super.data = value;
this.text = displayString(value[dataField]);
}


If you want to change all tooltips in your application, you can do so w/ CSS, as described in the docs herelink text.

I have found that to often be limiting, so it is more common I would create a custom toolTip.

The documentation is a bit confusing if memory serves me, so to create a custom toolTip you listen to the toolTipCreate method and replace the event.toolTip with your new toolTip. Toi position the new toolTip something other than the default, you must do that in a toolTipShow listener.


Just use custom simple HTMLToolTip class for your tooltips

http://flexscript.wordpress.com/2008/08/19/flex-html-tooltip-component/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号