Flex Datagrid 内容超出 column 宽度显示 tooltip
程序员文章站
2022-06-11 08:07:29
...
package
{
import mx.controls.dataGridClasses.DataGridItemRenderer;
public class TruncateText extends DataGridItemRenderer
{
private var textTruncated:Boolean = false;
private var originalText:String;
public function TruncateText()
{
super();
}
override public function set text(value:String):void
{
super.text = value;
originalText = value;
textTruncated = truncateToFit();
}
override public function validateProperties():void
{
super.validateProperties();
this.wordWrap=false;
this.setStyle("paddingTop",0);
this.setStyle("paddingBottom",0);
this.setStyle("paddingLeft",0);
this.setStyle("paddingRight",0);
toolTip = textTruncated ? originalText : null;
}
}
}