开发者

Removing the header from a Spark DataGrid

开发者 https://www.devze.com 2023-04-01 07:37 出处:网络
How do you remove the header row from a Spark DataGrid? MX DataGrid had the attribute \"showHeaders\" but this doesn\'t seem to be present in the Spark DataGrid.

How do you remove the header row from a Spark DataGrid? MX DataGrid had the attribute "showHeaders" but this doesn't seem to be present in the Spark DataGrid.

This seems like it should be a very easy task, so either I'm extremely dense or just missing something? Do I have to create a custom skin for my DataGrid and remove the header parts? That开发者_JAVA技巧 seems like overkill or is it the Flex / Spark way?

Thanks, Phil


You should create a custom skin for DataGrid. You should just copy standard spark.skins.spark.DataGridSkin and remove there the following lines:

    <!--- @private -->
    <s:GridColumnHeaderGroup id="columnHeaderGroup"
        paddingLeft="1" paddingTop="1" paddingRight="1" minHeight="21" 
        columnSeparator="{headerColumnSeparator}"
        headerRenderer="{headerRenderer}"/>


A lazy way is to set the skin's header height to 0:

<s:DataGrid id="dg"
  initialize="dg.columnHeaderGroup.height = 0"

or set the visible/includeInLayout properties:

<s:DataGrid id="dg"
  initialize="dg.columnHeaderGroup.visible =
              dg.columnHeaderGroup.includeInLayout = false"
0

精彩评论

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