Re: Formbuilder + DB_DataObjects + Structures_DataGrid
| From: | Justin Patrin | Date: | Mon, 25 Jul 2005 16:38:31 +0000 |
| Subject: | Re: Formbuilder + DB_DataObjects + Structures_DataGrid | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20127@lists.php.net to get a copy of this message | ||
On 7/25/05, Etienne van Tonder <evt@infoware.com.au> wrote:
> Hi,
>
> I'm using DB_DataObjects + DB_DataObjects_FormBuilder + Structures_DataGrid
> and my question has to do the fb_enumOptions array.
>
> Is it possible to get the enum strings rather than the DB integer values to
> display in the datagrid. At the moment all the enum fields display integer
> values which is not very useful from a users point of view.
>
> As all this information is already defined for FormBuilder in the
> DB_DataObject object, I'm sure it would be possible to use the enum string
> values.
>
> Is it possible to do this at the moment, if not any pointers on how I can
> change the code to do this.
>
Well....
If you're using a *normal* enum type in a database (like Mysql's) then
the DB should be returning the "display" values instead of #'s. If
you're implementing this yourself with an int field and fb_enumOptions
then I would suggest instead using a foreign key (link) and a lookup
table. This way the formbuilder_integration option can pull the links.
The formbuilder_integration code in
Structures/DataGrid/DataSource/DataObject.php could also be hacked to
support enums as well (if you do this, a patch in a feature request
would eb nice).
You could also use an SDG column formatter to look up the values.
--
Justin Patrin