Re: DB_DataObject and Structures_DataGrid integration
| From: | Justin Patrin | Date: | Fri, 13 Aug 2004 17:39:52 +0000 |
| Subject: | Re: DB_DataObject and Structures_DataGrid integration | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32637@lists.php.net to get a copy of this message | ||
On Fri, 13 Aug 2004 14:40:14 +0200, Olivier Guilyardi <ml@xung.org> wrote:
> Justin Patrin wrote:
> > On Thu, 12 Aug 2004 17:53:45 -0400, Andrew Nagy <asnagy@webitecture.org> wrote:
> >
> >>I am referring to the record edit pages. The fact that it is editing
> >>one record is not what I am talking about, it is the table layout not
> >>the content i am referring to.
> >>
> >> | Address | Phone | Edit
> >>--+---------+-------+------
> >>1 | | |
> >>--+---------+-------+------
> >>2 | | |
> >>--+---------+-------+------
> >>3 | | |
> >>
> >>For example, let's say I want to edit the address for every record, I
> >>would use the editable column for the address column. Now let's say I
> >>wanted to have a link for every record in the edit column. I could use
> >>a hyper link column as the column class.
> >
> >
> > Ok, it makes some sense, but it makes more sense to me to edit
> > per-record, not per-column. In fact, part of the idea was to be able
> > to edit multiple records at once (possibly all displayed).
>
> I think there is a confusion between the Edit button which has a dedicated
> column, and the actual Form. It makes sense to be able to add such
> "Link Columns" for any of Edit, Update, Buy, etc...
>
I think we're talking about cross-purposes here. Yes, there should be
an "Edit" column which has "Edit" links.
> But, I don't see the point with saying : "this record is editable, this
> one is not". I only see this alternative :
>
What I mean is that one record *at a time* will be editable, like the
example posted yesterday. This is simply done.
> - Or _no_ record is editable : this is the traditional grid with an optional
> Edit button which takes you to a form
>
> - Or _all records are editable : this would turn the grid into a multiple
> records form, very similar to a spreadsheet
Yes, both of these options ar eones that could and should be implemented
>
> About the "Link column" what about this :
>
> $column = new Structures_DataGrid_Column_Link("Edit");
> $column->attachEventHandler("edit_callback_function");
> $datagrid->addColumn($column);
>
> $column = new Structures_DataGrid_Column_Link("Delete");
> $column->attachEventHandler("delete_callback_function");
> $datagrid->addColumn($column);
Whenever I talk about "links" in a database context, I mean a foreign key.
Yeah, something like this might be useful.
>
> Event-based stuff, as .NET. The GET thingies are handled transparently.
> The prototype would be something like : callback_function($record_key)
The problem is, of course, you can't register a real callback for
something as web sites are request based. This *can* work, but it's
kinda weird.
>
> >>The same argument could be made for making an editable record. For
> >>example if I want to edit every column for record number 2.
> >>
> >>However, the reason I feel the way this should be done via a column
> >>class, is due to the data types. Let's say addresses are dropdowns and
> >>phone numbers are text boxes, I would need to define this per column.
> >
> >
> > It's already defined per-column in the db.ini file and the links.ini
> > file for DB_DataObject. In addition, FormBuilder already creates
> > select boxes for the links. This is all done, tested, and working code
> > in DB_DataObject_FormBuilder.
>
> Yeah this is very smart about DataObject, and DataGrid definitely has
> to transparently query the DO about column types and display the
> proper type of control (drop down list, text field, etc...).
It should actually ask FormBuilder for a form, then display it. This
would make it super simple to make the one-record-at-a-time approach
work. FormBuilder could also be used for the edit-all-at-once aproach,
but it will need seom revisions.
>
> >>Now the trick is, using my paradigm, how do you limit the editing on a
> >>per record basis.
> >
> > Using your paradigm, I don't see how you can. If only columns are
> > editable, then only columns are editable.
> >
> > BTW, looking at the latest phpMyAdmin, I still don't see editable columns.
> > http://www.phpmyadmin.net/phpMyAdmin/
> >
> > IMHO, DataGrid should focus on editable records, not columns.
>
> Why limiting the editing on a per-record basis ? For example, at the
> database level you usually grant permissions to the whole table,
> no to records.
>
> Of course, in some more complex situations, you can have an owner
> for each record, so that each user can only edit certain records.
> Is this the kind of issue you want to address ?
>
No, that's not at all what I'm saying. I'm not saying I'm limiting the
user to editing specific records, I'm saying that they can edit them
all, but only on at a time.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--