Re: DB_DataObject and Structures_DataGrid integration
| From: | Jackson Miller | Date: | Fri, 13 Aug 2004 14:14:44 +0000 |
| Subject: | Re: DB_DataObject and Structures_DataGrid integration | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32618@lists.php.net to get a copy of this message | ||
Now that this thread has lasted 3 days, should we move it to a datagrid
development list?
On Friday 13 August 2004 09:01 am, Olivier Guilyardi wrote:
> Personnally, I think the .NET way to attach event handlers is very
> interesting. As I proposed previously this could be done with :
>
> $column = new Structures_DataGrid_Column_Link("Edit");
> $column->attachEventHandler("edit_callback_function");
> $datagrid->addColumn($column);
>
> And a convenient shortcut :
>
> $datagrid->addButton("Edit", "edit_callback_function");
Here is how I do the something similar now:
$column = new Structures_DataGrid_Column('Edit', null, null, null, null, null,
'edit_callback_function($label=Edit) ');
Notice that the current implementation allows you to pass parameters in to the
callback function. The callback function also has a default param of $record
that allows you to access the associative array of the current row's data.
It even allows you to call class methods in addition to functions (thanks
Andrew).
So your proposal is really just for a callback to set the cell formatter
callback. It is clean and pretty that way, however it is more than just a
way to attach events, you can format the data that is displayed in the table
cell, so I think a better name might be setCallback or setFormatter.
Now, the current way does require you to create the callback method as it
would be pretty hard for it to use an existing function.
> What do you call "views" ? FormView and GridView? If this is what you mean,
> no, DataGrid is the grid, the form is another control. I think .NET-style
> inline forms may bring confusion.
My confusion was that I thought you were asking for DataGrid to provide both
the grid and the form. We are on the same page with that one.
I do think inline forms are important and make sense, but I can do it when I
need it.
-Jackson