【问题标题】:Is there a way to eliminate borders on a DataGridColumn in Flex?有没有办法消除 Flex 中 DataGridColumn 的边框?
【发布时间】:2011-10-13 18:16:58
【问题描述】:

我看不到消除 DataGrid 中某些边框的方法。我想消除我的 2 列的侧边框,使它们看起来像一列。

我正在尝试在我的每个 DataGrid 行上实现一个“清除值”按钮。我能够从一个单独的 ActionScript 文件在自定义 ItemRenderer 上显示一个按钮,但我不确定如何让按钮单击事件传播到 DataGrid 所在的 mxml 文件。如果有一个带有“清除”按钮的额外不可调整的列,对我来说会容易得多。

所以,重申一下:有什么方法可以改变边框样式或消除DataGridColumn 的某些边框?

【问题讨论】:

  • 你需要给组件皮肤。

标签: actionscript-3 flex4


【解决方案1】:

这有点老套,但我找到了满足我需求的解决方案。我制作了一个清晰的分隔符皮肤并将其用作verticalLockedSeparatorSkin,然后将列锁定到分隔符。这很有效,因为我的DataGrid 中没有水平滚动。但是,它只允许消除 2 列之间的单个边界(这就是我所需要的):

数据网格 mxml:

<mx:DataGrid lockedColumnCount="2" verticalLockedSeparatorSkin="ClearGridSeparatorSkin">
    <mx:columns>
        <mx:DataGridColumn />
        <mx:DataGridColumn />  <!-- this column is to the left of the clear separator -->
        <mx:DataGridColumn />  <!-- this column is on the right side of the separator -->
    </mx:columns>
</mx:DataGrid>

分隔皮肤(作为动作类):

package com.example.ClearSeparator
{
    import mx.skins.ProgrammaticSkin;
    public class ClearGridSeparatorSkin extends ProgrammaticSkin
    {
        public function ClearGridSeparatorSkin()
        {
            this.alpha=0;
            this.width=1;
            super();
        }
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-28
    • 2014-10-15
    • 1970-01-01
    • 2020-03-27
    • 1970-01-01
    • 2019-05-20
    相关资源
    最近更新 更多