This plugin contains a grid subframework that allows to read various data sources in a unified way. These data sources
can be rendered in a customizable grid with a custom formatter. The code of this plugin will eventually become bundled with symfony
1.3.

Currently, arrays and Doctrine tables can be used as data sources. Propel, XML and CSV are planned for the final version Only a HTML
formatter is currently supported. A raw text formatter and an XML formatter are planned for the final version.

THIS PLUGIN IS IN VERY EARLY ALPHA STAGES AND IS NOT RECOMMENDED FOR PRODUCTION USE.

Please NOTE: this plugin has been updated, and now depends on the sfDataSourcePlugin

Introduction

This plugin contains a grid subframework that allows to read various data sources in a unified way.
These data sources will be rendered in a customizable grid with a custom formatter.

Currently a HTMLand text formatter are supported. The release of the JSON formatter is expected soon.

Howto

A quick guide to show how to start using the sfGrid.

First install the sfDataSourcePlugin.

In this example I will show the usage with the help of the sfDataSourcePropel class, however sfDataSourceDoctrine and sfDataSourceArray are available as well.

The DataSource can be provided to the sfGrid in order to render the data to the screen.

A slightly more specialised version of the sfGrid, the sfWebGrid that can be bond to the webRequest, will be used
in order to automatically process the interaction with the grid (the sorting and paging).
Before you can render your grid in a template you first have to provide the columns available from your sfDataSource to the grid.
Besides you probably want to define the title for the columns in your grid.

// get a dataSource$dataSource = new sfDataSourcePropel('City');
// create a grid bound to your dataSource$this->grid = new sfWebGrid($dataSource);
// and bind in to the request to handle interaction$this->grid->bind($request);
// sorting is disabled by default, so enable it to all columns$this->grid->setSortable(sfGrid::ALL);
// and define the default sort-order// (in this case the sfDataSourcePropel knows how to handle the relation, and will automatically perform a join!) $this->grid->setDefaultSort('Country.Name', sfGrid::ASC);
// define the columns you want to see$this->grid->setColumns(array('Country.Name',
'Name'));
// and overrule their titles$this->grid->setColumnTitles(array('Country.Name' => 'Country',
'Name' => 'City'));

The definition of columns in your grid is relative to your base object in your datasource.
If you request related columns, from for example a country, the datasourcePropel will automatically
perform a join on the album and hydrates this object as well. For Doctrine I haven't developed this yet,
so maybe someone can write a behavior to support this as well (I am happy to help you with developping this, although short on time...),
or you should setup your Doctrine-Query before providing it to the dataSource.

Todo:

Add an example CSS
show more extensive examples

Note

The sfDataSourcePlugin is required for the sfGridPlugin.

License

see LICENSE file

Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Join this plugin team

Changelog for release 0.1.1 - 07/02/2009

Other releases

Release 0.1.1 - 07/02/2009

This plugin contains a grid subframework that allows to read various data sources in a unified way. These data sources can be rendered in a
customizable grid with a custom formatter. The code of this plugin will eventually become bundled with symfony 1.3.

Currently, arrays and Doctrine tables can be used as data sources. Propel, XML and CSV are planned for the final version Only a HTML formatter is
currently supported. A raw text formatter and an XML formatter are planned for the final version.

THIS PLUGIN IS IN VERY EARLY ALPHA STAGES AND IS NOT RECOMMENDED FOR PRODUCTION USE.