Re: DataGrid - Column Addition
| From: | Justin Patrin | Date: | Thu, 26 May 2005 17:54:17 +0000 |
| Subject: | Re: DataGrid - Column Addition | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19377@lists.php.net to get a copy of this message | ||
On 5/26/05, Edward Grace <ej.grace@imperial.ac.uk> wrote:
> Is there a way of modifying the Structures::DataGrid object so that using
> addColumn() does not wipe out auto generated columns?
>
I've asked for this before, but ended up doing things manually. See my
DB_DO_FB_Frontend code:
http://pear.reversefold.com/horde/chora/co.php?r=1.13&f=DB_DataObject_FormBuilder_Frontend%2FFrontend%2FShowTable.php#115
> I've looked through the code but cannot see where using the addColumn() method
> wipes out auto column generation.
addColumn itself does not do this. The columns are auto-created only
if there are no columns added. See Structures/DataGrid/Renderer.php
function _setDefaultHeaders().
>
> The reason I want to do this is to implement buttons / links automatically for
> DataGrid generated tables from a DataObject source. Essentially I am looking
> for a way to automatically augment the generated table with controls (Add /
> Edit / or checkboxes) such as those mentioned in the referenced .Net object:
>
That's the same reason I wanted to do it, see the other addColumn
calls in the above code. IMHO it's easy enough to manually add the
columns, so I didn't push further. However, I would think it would be
pretty easy to make the auto-column creation happen if the
generate_columns option is set in the DataSource. The quesiton then is
whether they should be before or after the manually added columns....
--
Justin Patrin