SQLFORM.grid 'headers' doesn't change column header

274 views
Skip to first unread message

Andrii Pitukh

unread,
Mar 26, 2013, 6:01:03 AM3/26/13
to web...@googlegroups.com
I created the following form:

SQLFORM.grid(dbm.groups_subjects, headers={'table1.field1':T('Myname1'))

The names of columns that are set in headers are shown correctly (I see Myname1 as header). But when I press view or create, I see 'field1' as column header instead of 'Myname1'

Niphlod

unread,
Mar 26, 2013, 6:20:10 AM3/26/13
to web...@googlegroups.com
the form has normally the label of that field ..... headers are for the table representation only

Andrii Pitukh

unread,
Mar 26, 2013, 7:07:29 AM3/26/13
to web...@googlegroups.com
Can you write a code example?  SQLFORM constructor has 'labels' parameter, but  SQLFORM.grid doesn't have it.

Niphlod

unread,
Mar 26, 2013, 7:39:00 AM3/26/13
to web...@googlegroups.com
SQLFORM.grid "takes" the labels from the underlying model, so as long as you specify the label before calling the grid, you're fine.

db.table1.field1.label = 'whatever'
grid = SQLFORM.grid(db.table1)

should work.

Andrii Pitukh

unread,
Mar 27, 2013, 6:17:19 AM3/27/13
to web...@googlegroups.com
Works perfectly, thanks!
Reply all
Reply to author
Forward
0 new messages