Re: DB_DataObject and Structures_DataGrid integration
| From: | Olivier Guilyardi | Date: | Fri, 13 Aug 2004 14:57:29 +0000 |
| Subject: | Re: DB_DataObject and Structures_DataGrid integration | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32623@lists.php.net to get a copy of this message | ||
Jackson Miller wrote:
Now that this thread has lasted 3 days, should we move it to a datagrid development list?I think it's not only DG related. It's something else, I don't know what to call, all about grid views, form views, datasource binding, etc...
On Friday 13 August 2004 09:01 am, Olivier Guilyardi wrote:Sorry, I did not express my ideas clearly here : the event handler callback function I'm talking about is not a formatter. It's about the event-based UI paradigm. 1 - the datagrid fires an event when the user click on the Edit Button 2 - the corresponding event handler is then called with the record key passed as parameter As such the event handler is not formatting anything. It's more like : "Hey I got called because the user clicked Edit on record 5, let's display a form for that". Of course the event-based paradigm has to be adapted to web-development, but it looks like .NET has achieved a such thing.$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.
No of course. I'm not asking it to provide the form, I'm asking it to be well coupled with, say, FormBuilder. It's the same with DO : I'm not asking the DG to provide a datasource by itself, but to be well coupled with, and _understand_, the datasources it uses.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.I'm currently not able to think about inline forms. There's still too much work to do in the underlying layers. But, it would be sad if a design issue forbids implementing them in the future. -- og