3
votes

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 seems like overkill or is it the Flex / Spark way?

Thanks, Phil

2

2 Answers

3
votes

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}"/>
2
votes

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"