[DataGrid]: column formatter with callback function
| From: | Mark Steudel | Date: | Sat, 19 Nov 2005 18:48:19 +0000 |
| Subject: | [DataGrid]: column formatter with callback function | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-22009@lists.php.net to get a copy of this message | ||
Ok I'm having problem specifying the callback function.
function print_actions( $actions )
{
foreach ( $actions as $key => $value)
{
switch($value)
{
case "edit":
$action .= '<a
href="'.$_SERVER[PHP_SELF].'?action=edit&id='.$record['id'].'">Edit</a>
/';
break;
case "delete":
$action .= ' <a
href="'.$_SERVER[PHP_SELF].'?action=delete&id='.$record['id'].'">Delete<
/a>';
break;
}
}
return $action;
}
$actions = array( 'edit', 'delete');
$dg->addColumn(new Structures_DataGrid_Column('Actions', null, null, null,
null, print_actions( $actions )));
Also, is $record, something that is automatically accesible from SDG? In the
example from the documentation:
http://pear.php.net/manual/en/package.structures.structures-datagrid.formatt
er.php
I didn't see $record being set anywhere.
Thnx, Mark