Structures_DataGrid 0.8.0 released

Today Olivier and I have “flooded” PEAR with new releases of Structures_DataGrid and its 19 subpackages. The reason for releasing all packages was a license change from PHP License 2.0 to New BSD license which is more flexible and compatible to other open source licenses.

The new major feature of the new release is streaming support. Until this release, it was impossible to use Structures_DataGrid for converting a huge database table into, for example, a CSV file. We offer now the possibility to fetch the data in chunks of, by default, 500 records from the database and to write these records into the CSV file, followed by the next chunk of 500 records, and so on.

Streaming can be enabled by calling $datagrid->enableStreaming(); and it is supported by all database DataSource drivers and the CSV and XML renderers. Support for the XML DataSource driver and maybe also other renderers is planned.

Another new feature is the format() method of the column object that offers some auto-formatters for columns in order to avoid that each and every user of Structures_DataGrid needs to implement basic formatter functions themselves. Please note that this new format() method is experimental and might be changed in the future.

Here are some examples of the usage:

// Format UNIX timestamps as english dates:
$column->format('dateFromTimestamp', 'm/d/y');

// Format numbers with 3 decimals and no thousands
// separator:
$column->format('number', 3, '.', '');

// Format an HTML link using a printf expression with
// url-encoding:
  '<a href="edit.php?key=%s">Edit</a>');

For the future of Structures_DataGrid we are planning two new DataSource drivers (for PDO and Doctrine, after its code was PEARified and accepted), two new Renderers (HTMLEditForm and HTMLFilterForm), and also some new features for the core package.

Comments are closed.