For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > July 2005 > Re: [PEAR] Formbuilder + DB_DataObjects + Structures_DataGrid









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Formbuilder + DB_DataObjects + Structures_DataGrid
Justin Patrin

2005-07-25, 5:32 pm

On 7/25/05, Etienne van Tonder <evt@infoware.com.au> wrote:
> Hi,
>=20
> I'm using DB_DataObjects + DB_DataObjects_FormBuilder + Structures_DataGr=

id
> and my question has to do the fb_enumOptions array.
>=20
> 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 intege=

r
> values which is not very useful from a users point of view.
>=20
> 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 strin=

g
> values.
>=20
> Is it possible to do this at the moment, if not any pointers on how I can
> change the code to do this.
>=20


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.

--=20
Justin Patrin
Etienne van Tonder

2005-07-25, 10:05 pm

Hi Justin,

Thanks for the response, I was thinking of adding my changes to
Structures/DataGrid/DataSource/DataObject.php but was a bit worried as I was
not sure what to change. I've taken the plunge and made my changes, I'm not
a php expert so I'm sure it could be done better but is seems to work as
expected. I've posted my code changes as a feature request.

Regards,

Etienne.

"Justin Patrin" <papercrane@gmail.com> wrote in message
news:432beae05072509384c552787@mail.gmail.com...
On 7/25/05, Etienne van Tonder <evt@infoware.com.au> wrote:

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com