Re: [DataGrid]: column formatter with callback function

From: Date: Sun, 20 Nov 2005 05:06:52 +0000
Subject: Re: [DataGrid]: column formatter with callback function
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22015@lists.php.net to get a copy of this message
On 11/19/05, Mark Steudel <mark@netriver.net> wrote: > 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&amp;id='.$record['id'].'">Edit</a> > /'; > break; > case "delete": > $action .= ' <a > > href="'.$_SERVER[PHP_SELF].'?action=delete&amp;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 ))); 1) Look at the docs 2) That could never work. You're passing in the return value of that function as the callback. Perhaps try: 'print_actions()' and define $actions in the function. > > Also, is $record, something that is automatically accesible from SDG? In the > example from the documentation: > ° …îôSvIݩР> „http://pear.php.net/manual/en/package.structures.structures-datagrid.formatt > er.php > I didn't see $record being set anywhere. > > Thnx, Mark > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Justin Patrin

« previous php.pear.general (#22015) next »