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

Bug #7710 bind() interferes with rendering
Submitted: 2006-05-23 20:21 UTC
From: olivierg Assigned: olivierg
Status: Closed Package: Structures_DataGrid (version CVS)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-05-23 20:21 UTC] olivierg (Olivier Guilyardi)
Description: ------------ This bug is related to the following post on pear-general : http://marc.theaimsgroup.com/?l=pear-general&m=114840840317280&w=2 There is a problem when mixing the "generate_columns" option with addColumn() columns. When "generate_columns" is set to true, columns are generated and displayed for every field set with the "fields" option. But, as reported by Toppi in the said thread, there may be fields that must be fetched by the datasource, but not displayed. This is important for row id and other sort of data that the user may use in a formatter passed to addColumn(). Because the "fields" option is passed to bind() we may call it a "data binding option", while options passed to render() are "rendering options". In this regard, when passed to bind(), the "fields" option should set "what to retrieve from the datasource" and not "what to display", because this later is about rendering and not about data binding. The solution might be to have another option passed to render() that actually set which fields must be rendered. And the data binding() "fields" option would set what to retrieve from the datasource. More generally, I'm not sure that generating columns should be done by the datasource layer. It sounds more like a rendering problematic. Concerning the workaround that consists to forget about "generate_columns" and declare all the columns with addColumn() : that's very heavy IMO. That's ok when you have 3 columns, but with more columns "generate_columns" is really handy. Another, but related, point is this "labels" option which is passed to bind(), but is clearly a rendering option. It should be passed to render(), with a BC fix so that bind() still accepts it.

Comments

 [2006-12-14 00:48 UTC] olivierg at php dot net (Olivier Guilyardi)
This bug is fixed in CVS. The DataSource "generate_columns" and "labels" are now deprecated (BC is provided). The "fields" option is still here to set which fields to retrieve from the datasource. But, the datasource is not responsible anymore for building columns. This can easily be done with the new Structures_DataGrid::generateColumns() method for simple columns, together with addColumns() for more complex ones. It is now possible to retrieve a given set of fields from the datasource and to render only a subset of them.