Hi,

I have a smartgrid and I want to show the names in different colors.

This is my model:

db.define_table('child',
    Field('name'),
    Field('color', default='black'),
    Field('parent','reference auth_user'),
    )

db.child.name.represent=lambda id, row: SPAN(row.name, _style="color:%s;" %
row.color)

And this is one function:

def f1():

    grid = SQLFORM.smartgrid(
        db.auth_user,
        fields=[db.auth_user.id, db.auth_user.first_name,
db.auth_user.last_name,
          db.child.name, db.child.id, db.child.color],
        linked_tables=['child'],
        user_signature=False,
        )

    return dict(form=grid)

Works fine, but there is the column "Color" in the table "Children", which
should not be visible.
Changing the function to

        fields=[db.auth_user.id, db.auth_user.first_name,
db.auth_user.last_name,
          db.child.name, db.child.id],

shows an error message about the missing "color" in the row.

Is it possible to use a column without showing it? Any ideas?

Regards, Martin

-- 



Reply via email to