Never mind figured it out.
types = {
  'bp': 'Product Bonus',
  'sb': 'Sponsor Bonus',
}
db.cash_journal.transaction_type.represent = lambda transaction_type,row:
types[transaction_type]
    ucashHistoryGrid = SQLFORM.grid(
            db.cash_journal,
            paginate=10, deletable=False, editable=False, details=False,
csv=True, formname='ucash-history',
    )


On Thu, Feb 9, 2012 at 2:35 PM, Bruce Wade <[email protected]> wrote:

> Hi,
>
> In the old framework I would just query the database and loop through the
> values manually creating the HTML table etc...
>
> Which allows me to do something like this:
> types = {
>   'bp': 'Product Bonus',
>   'sb': 'Sponsor Bonus',
> }
> <table>
> for row in rows:
>   <tr>
>      <th>Type</th>
>      <td>types[row.type]</td>
>   </tr>
> </table>
>
> Is there a way to use SQLFORM.grid and tell it to display a dictionary
> value based on the key stored in the database?
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com

Reply via email to