Re: Structures_DataGrid question - nice sorting and table layout but how to page and add edit buttons?
| From: | Justin Patrin | Date: | Thu, 17 Nov 2005 04:22:06 +0000 |
| Subject: | Re: Structures_DataGrid question - nice sorting and table layout but how to page and add edit buttons? | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21954@lists.php.net to get a copy of this message | ||
On 11/16/05, Olivier Guilyardi <ojaiml@nerim.net> wrote:
> Brett Bieber wrote:
> > Hey
> >
> > On 11/16/05, l Burnerheimerton <lburnerheimerton@yahoo.com> wrote:
> >>
> >>I tried Structures_DataGrid and like it. However, how
> >>do you:
> >>1--page results sets with it
> >>2--add an edit button to each row
> >>3--rename column headings
> >
> > http://www.samalyse.com/code/pear/dgdo/
>
> Yeah :-) The only thing not addressed in this tutorial is the Edit button..
>
> That currently is performed with something like :
>
> function editLink ($row)
> {
> return "<a
> href=\"edit.php?id={$row['id']}\">Edit</a>";
> }
>
> $column = new Structures_DataGrid_Column ('Edit', null, null,
> null, null, 'editLink()');
> $datagrid->addColumn ($column);
Which is exactly the kind of thing that
DB_DataObject_FormBuilder_Frontend does. If you're looking for a DB
data editor I would recommend you take a look.
http://pearified.com/index.php?package=DB_DataObject_FormBuilder_Frontend
>
>
> > and read the docs for datagrid.
>
> > Large datasets can cause problems because the entire set must be loaded to
> > create the paging features, but all in all a great tool.
>
> No, Structures_DataGrid always try to count rows in a smart way. For example it
> calls the DB_DataObject::count() method, which in turn performs a "SELECT
> count(*) ..." sort of query.
> Of course, some drivers have limitations (ex: Array).
>
AFAIK SDG only does smart querying with DB_DO, although it may have
new drivers or capabilities I've missed. The normal DB query driver
certainly doesn't do this, though.
> A new PDO driver has been refused mainly because it needed to load the whole
> data to count rows. Any new driver doing a such thing is likely not to be accepted.
>
--
Justin Patrin