Structures_DataGrid

Structures_DataGrid is a class for building, manipulating and rendering a tabular structure of data. It has the ability to allow you to render a datagrid in HTML format as well as many other formats such as an XML Document, an Excel Spreadsheet, an XUL Document and more.

It also offers paging and sorting functionality to limit the data that is presented. This concept is based on the .NET Framework DataGrid control and works very well with database and XML result sets.

Introduction and Features

Table of Contents
Introduction -- What can I do with Structures_DataGrid?
FAQ -- Answers to most Frequently Asked Questions
Installation -- How to install the core and drivers packages
DataSources -- What is a DataSource Driver?
Rendering the output -- What formats can I render the output?
Column Formatter -- What can I do with the column formatter?
Example - Quick -- Quickly retrieve data from a database table
Example - Complex -- How to build a datagrid using many of the features
Custom DataSources --  How to write your own DataSource driver.
Custom Renderers --  How to write your own Rendering driver.

Class Structures_DataGrid

Table of Contents
constructor Structures_DataGrid::Structures_DataGrid() -- Constructor
Structures_DataGrid::addColumn() -- Add a column, with optional position
Structures_DataGrid::attachRenderer() -- Attach an already instantiated Rendering driver
Structures_DataGrid::bind() -- A simple way to add a record set to the datagrid
Structures_DataGrid::bindDataSource() -- Bind an already instantiated DataSource driver
Structures_DataGrid::build() -- Build the datagrid
Structures_DataGrid::dataSourceFactory() -- Datasource driver Factory
Structures_DataGrid::fill() -- Fill a rendering container with data
Structures_DataGrid::getColumnByField() -- Find a column by field name
Structures_DataGrid::getColumnByName() -- Find a column by name (label)
Structures_DataGrid::getColumnCount() -- Returns the number of columns
Structures_DataGrid::getCurrentPage() -- Retrieves the current page number when paging is implemented
Structures_DataGrid::getCurrentRecordNumberEnd() -- Returns the number of the last record of the current page
Structures_DataGrid::getCurrentRecordNumberStart() -- Returns the number of the first record of the current page
Structures_DataGrid::getDataSource() -- Get the currently loaded DataSource driver
Structures_DataGrid::getOutput() -- Return the datagrid output
Structures_DataGrid::getPageCount() -- Returns the total number of pages
Structures_DataGrid::getRecordCount() -- Returns the total number of records
Structures_DataGrid::getRenderer() -- Get the current or default Rendering driver
Structures_DataGrid::removeColumn() -- Remove a column
Structures_DataGrid::render() -- Render the datagrid
Structures_DataGrid::setCurrentPage() -- Define the current page number.
Structures_DataGrid::setDataSourceOption() -- Set a single datasource option
Structures_DataGrid::setDataSourceOptions() -- Set multiple datasource options
Structures_DataGrid::setDefaultSort() -- Set default sorting specification
Structures_DataGrid::setRenderer() -- Set Renderer
Structures_DataGrid::setRendererOption() -- Set a single renderer option
Structures_DataGrid::setRendererOptions() -- Set multiple renderer options
Structures_DataGrid::setRequestPrefix() -- Set the global GET/POST variables prefix
Structures_DataGrid::sortRecordSet() -- Sorts the records by the defined field.

Class Structures_DataGrid_Column

Table of Contents
Class Summary Structures_DataGrid_Column -- Structures_DataGrid_Column Class
constructor Structures_DataGrid_Column::Structures_DataGrid_Column() -- Constructor
Structures_DataGrid_Column::formatter() -- Formatter
Structures_DataGrid_Column::getAttributes() -- Get the column XML/HTML attributes
Structures_DataGrid_Column::getAutoFillValue() -- Get auto fill value
Structures_DataGrid_Column::getField() -- Get name of the field for the column to be mapped to
Structures_DataGrid_Column::getLabel() -- Get column label
Structures_DataGrid_Column::getOrderBy() -- Get the field name or the expression to order the data by
Structures_DataGrid_Column::setAttributes() -- Set the column XML/HTML attributes
Structures_DataGrid_Column::setAutoFillValue() -- Set auto fill value
Structures_DataGrid_Column::setField() -- Set name of the field for the column to be mapped to
Structures_DataGrid_Column::setFormatter() -- Set Formatter
Structures_DataGrid_Column::setLabel() -- Set column label
Structures_DataGrid_Column::setOrderBy() -- Set the field name or the expression to order the data by

DataSource drivers

Table of Contents
Structures_DataGrid_DataSource_Array -- Array Data Source Driver
Structures_DataGrid_DataSource_CSV -- Comma Seperated Value (CSV) Data Source Driver
Structures_DataGrid_DataSource_DataObject -- PEAR::DB_DataObject Data Source Driver
Structures_DataGrid_DataSource_DB -- PEAR::DB Data Source Driver
Structures_DataGrid_DataSource_DBQuery -- PEAR::DB SQL Query Data Source Driver
Structures_DataGrid_DataSource_DBTable -- PEAR::DB_Table Data Source Driver
Structures_DataGrid_DataSource_MDB2 -- PEAR::MDB2 SQL Query Data Source Driver
Structures_DataGrid_DataSource_RSS -- RSS data source driver
Structures_DataGrid_DataSource_XML -- XML data source driver

Renderer drivers

Table of Contents
Structures_DataGrid_Renderer_Console -- Console Table Rendering Driver
Structures_DataGrid_Renderer_CSV -- CSV Rendering Driver
Structures_DataGrid_Renderer_HTMLSortForm -- Multiple fields sorting form rendering driver
Structures_DataGrid_Renderer_HTMLTable -- HTML Table Rendering Driver
Structures_DataGrid_Renderer_Pager -- Pager rendering driver
Structures_DataGrid_Renderer_Smarty -- Smarty Rendering Driver
Structures_DataGrid_Renderer_XLS -- Excel Spreadsheet Rendering Driver
Structures_DataGrid_Renderer_XML -- XML Rendering Driver
Structures_DataGrid_Renderer_XUL -- XUL Rendering Driver