Re: Callback to a method in a class using Structures_DataGrid_Column
| From: | Justin Patrin | Date: | Fri, 15 Jul 2005 16:59:39 +0000 |
| Subject: | Re: Callback to a method in a class using Structures_DataGrid_Column | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20019@lists.php.net to get a copy of this message | ||
On 7/13/05, PHPDiscuss - PHP Newsgroups and mailing lists
<hernan@postmaster.co.uk> wrote:
> Hi. Maybe this question is not PEAR specific, sorry if this is not the
> place to ask this. Is possible to use a callback from a class to a
> function defined in the same class?
>
> <?php
> function printCheckBox($params) { ... }
> ..
> dg->addColumn(new Structures_DataGrid_Column(null, null, null, array('width'
> => '10'), null, 'printCheckbox()'));
> ..
> ?>
>
> and get something like
>
> <?php
>
> class X {
>
> function printCheckBox($params) { ... }
>
> function display() {
> ...
> dg->addColumn(new Structures_DataGrid_Column(null, null, null,
> array('width' => '10'), null, '$this->printCheckbox()'));
> ...
> }
> }
> ?>
> I know second option is wrong :) but get the idea?
> TIA
>
> Reference:
>
> http://pear.php.net/manual/en/package.structures.structures-datagrid.example-advanced.php
>
No, I don't think that Structures_DataGrid supports "real" callbacks
as it is. It currently only supports "static" callbacks. It could (and
should IMHO) be made to deal with normal callbacks.
--
Justin Patrin