Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Bug #4454 No way to augment auto-generated columns with user defined columns
Submitted: 2005-05-27 16:17 UTC
From: ej dot grace at imperial dot ac dot uk Assigned:
Status: Duplicate Package: Structures_DataGrid
PHP Version: 4.3.10 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 37 - 14 = ?

 
 [2005-05-27 16:17 UTC] ej dot grace at imperial dot ac dot uk
Description: ------------ The following is an edited discussion from pear-general@lists.php.net regarding this issue. =========== E Grace ===================Is there a way of modifying the Structures::DataGrid object so that using addColumn() does not wipe out auto generated columns? I've looked through the code but cannot see where using the addColumn() method wipes out auto column generation. 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: http://tinyurl.com/crmsv ================================================== Justin Patrin > 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(). =================================================== E Grace > 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(). Ahh!!! *lightbulb moment*, I see. That gets called by (Say DataGrid/Renderer/HTMLTable->getTable(), it seems silly not to have a simple switch somewhere and an ->allowAutoGeneration() method or something. Of course this would mean that the columns one adds manually would come before the auto generated columns. Doubtless a similar simple hack would allow one to control the ordering, perhaps, addColumnLeft() and addColumnRight() methods.. ==================================== Final notes: Perhaps this is something that should be considered at the renderer level. If one were to add a column with controls for editing records, that would be good for the HTMLTable rendered version, but meaningless for the CSV rendered version. Currently the control over what columns get generated sits in Rendered->_setDefaultHeaders() (which is private) so there is no easy way to specify this on a renderer by renderer basis. For example one could have leave the classic HTMLTable renderer as it is and have a new renderer class which allows easy addition of controls etc, or supply the renderer as a user defined callback, just a thought.

Comments

 [2005-10-05 01:27 UTC] olivierg at php dot net
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the existing bug instead. Thank you for your interest in PEAR. Please see bug #3306