数据网格的 itemrenderer 的工具提示的内联格式?
如何设置工具提示部分的样式,例如粗体?我正在数据网格的 itemrenderer 中生成工具提示,显示列名称,然后显示值:我想以粗体显示值...
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[fieldName]));
}
this.toolTip = toolString;
super.data = value;
this.text = displayString(value[dataField]);
}
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[fieldName]));
}
this.toolTip = toolString;
super.data = value;
this.text = displayString(value[dataField]);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想更改应用程序中的所有工具提示,可以使用 CSS 进行操作,如此处文档中所述链接文本。
我发现这通常是有限制的,所以更常见的是我会创建一个 自定义工具提示。
如果我没记错的话,文档有点令人困惑,因此要创建自定义工具提示,您需要监听 toolTipCreate 方法,并将 event.toolTip 替换为新的工具提示。要定位新的工具提示而不是默认位置,您必须在 toolTipShow 侦听器中执行此操作。
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.
只需使用自定义简单的 HTMLToolTip 类作为工具提示
http:// flexscript.wordpress.com/2008/08/19/flex-html-tooltip-component/
Just use custom simple HTMLToolTip class for your tooltips
http://flexscript.wordpress.com/2008/08/19/flex-html-tooltip-component/