PEAR Manual
Prev |  | Next

# Structures_DataGrid::addColumn()

Structures_DataGrid::addColumn() -- Adds a Structures_DataGrid_Column object to the DataGrid's column collection

## Synopsis

``mixed Structures_DataGrid::addColumn` (Structures_DataGrid_Column $column)`

## Description

This method is used to add a Structures_DataGrid_Column object to the DataGrid's Column Collection. If no columns are added to the collection, the DataGrid will attempt to use it's own column names that can be gathered from the data set. However, once you use this method, the DataGrid will no longer attempt to auto-generate columns for you.

## Parameter

Structures_DataGrid_Column `$column`

  The Structures_DataGrid_Column object to be defined.

## Example

Example 55-1. Defining a column
    <?php
    require_once 'Structures/DataGrid.php';

    $dg =& new Structures_DataGrid();
    $column = new Structures_DataGrid_Column('Title', 'title', 'title', array('align' => 'center'), 'N/A', null);
    $dg->addColumn($column);
    ?>

Prev | Home | Next
Structures_DataGrid::Structures_DataGrid() | Up | Structures_DataGrid::addRecord()