Re: Callback to a method in a class using Structures_DataGrid_Column
| From: | Hernan . | Date: | Fri, 15 Jul 2005 19:52:33 +0000 |
| Subject: | Re: Callback to a method in a class using Structures_DataGrid_Column | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20022@lists.php.net to get a copy of this message | ||
Ok, thanks Justin. Just for the record, I fixed using
class ActionProcess extends HTML_QuickForm_Action {
function printCheckbox($params) { ... }
function perform(&$page, $actionName) {
...
$column = new Structures_DataGrid_Column(...params...,
'ActionProcess::printCheckbox()');
... }
}
On Fri, 15 Jul 2005 09:59:39 -0700 , Justin Patrin <papercrane@gmail.com> wrote:
>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
>
_______________________________________________________________
Build your own website, it's easy and fun.
http://www.homemaster.net - Homemaster. Come Together.
Online.