PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Structures » Structures_DataGrid » Bug #5328

DataGrid Autofill Does Not Take Precedence Over Formatter

Details

Submitted2005-09-07 21:50 UTC
FromNEvans at dsl dot net
StatusBogus
PackageStructures_DataGrid
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-09-07 21:50 UTC] NEvans at dsl dot net

Description:
------------
DataGrid Version: $Revision: 1.1.1.1

The AddColumn autofill value is not respected when the formatter function fails to return anything.

Test script:
---------------
<?php
// ...include datagrid, functions, db connector, etc
function dgDetailLink($params) {
extract($params);
if($record['num'] > 0) {
return "value";
}
}
// ...start your datagrid, etc
$dg->addColumn(new Structures_DataGrid_Column('Num','num','num',array('align' => 'right'),"None",'dgDetailLinks()'));
// ...render the datagrid (using the HTML renderer)
?>

Expected result:
----------------
I would expect anything that had a 'num' of 0 to be "None" instead of a blank table cell, because the formatter did not return anything at all in the case of 'num' being 0.

Actual result:
--------------
The 'Num' column is rendered out with empty cells where 'num' was 0.

[2005-09-12 13:41 UTC] asnagy at php dot net

Thank you for taking the time to write to us, but this is not
a bug.

This is expected behavior. The callback is the overriding control method.

For your case, just simply add an else clause.