Re: Structures_DataGrid question - nice sorting and table layout but how to page and add edit buttons?
| From: | Olivier Guilyardi | Date: | Thu, 17 Nov 2005 01:20:04 +0000 |
| Subject: | Re: Structures_DataGrid question - nice sorting and table layout but how to page and add edit buttons? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21953@lists.php.net to get a copy of this message | ||
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);
> 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).
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.
--
og