DataGrid header显示tooltip

本文介绍如何在Flex的DataGrid组件中设置列头的提示信息和实现换行功能,适用于列名较长而实际值较短的情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        有时需要在DataGrid的header上显示提示信息,例如列名比较长,但是实际值比较短这就可以使用列头的tooltip,当然也可以列头换行。

 

      

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/02/08/displaying-tool-tips-in-a-flex-datagrid-controls-header/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:XML id="xmlDP">
        <nodes>
            <node col1="One.1" col2="One.2" />
            <node col1="Two.1" col2="Two.2" />
            <node col1="Three.1" col2="Three.2" />
            <node col1="Four.1" col2="Four.2" />
            <node col1="Five.1" col2="Five.2" />
            <node col1="Six.1" col2="Six.2" />
            <node col1="Seven.1" col2="Seven.2" />
            <node col1="Eight.1" col2="Eight.2" />
            <node col1="Nine.1" col2="Nine.2" />
        </nodes>
    </mx:XML>

    <mx:DataGrid id="dataGrid"
            dataProvider="{xmlDP.node}"
            width="300"
            height="200">
        <mx:columns>
            <mx:DataGridColumn dataField="@col1"
                    headerText="The quick brown fox jumped over the lazy dog"
                    headerRenderer="mx.controls.Label" />
            <mx:DataGridColumn dataField="@col2"
                    headerText="Lorem ipsum dolor sit amet, consectetuer adipiscing elit"
                    headerRenderer="mx.controls.Label" />
        </mx:columns>
    </mx:DataGrid>

</mx:Application>

 

 

   注:以上列头的提示信息内容是headText的信息,如果想修改tooltip的提示信息,那就需要自定义一个headRenderer。

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值