The Spark Grid control

The Spark DataGrid control is a skinnable component that uses a Grid control as a skin part. The Grid control displays a list of data items in a two-dimensional grid of cells. Each object in the data provider of the Grid control defines a single row. Individual properties of each object define each cell of the row.

A GridColumn object represents each column of the Grid control. The GridColumn object is responsible for displaying a cell value for each row of the grid. To display a cell, the GridColumn object specifies an item renderer. To edit a cell, the GridColumn object specifies an item editor.

The Grid control only creates as many item renderers as are required to display the currently visible cells. For example, you define a Grid control with hundreds or thousands of rows. Flex only creates enough item renderers to display the currently visible cells, but not for the cells that are currently off the screen.

When a cell is moved off the visible area of the screen, its item renderer is recycled. That means the item renderer can be reused when a new cell moves onto the visible area of the screen. Recycling item renderers greatly reduces the overhead required to use the Grid control.

The following list describes some other differences between the DataGrid and Grid controls:

  • Unlike the DataGrid control, the Grid control is not skinnable.

  • By default, the Grid control does not display scroll bars. To add scroll bars, wrap the Grid control in the Scroller component.

  • The Grid control does not provide default mouse or keyboard event handling. You must add support for those events yourself.