Removing the header from a Spark DataGrid

Phil picture Phil · Sep 2, 2011 · Viewed 7.8k times · Source

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

Answer

Constantiner picture Constantiner · Sep 2, 2011

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