predefined label and SQLTABLE header

7 views
Skip to first unread message

vince

unread,
Jan 15, 2009, 6:10:32 AM1/15/09
to web2py Web Framework
i think SQLTABLE header should read the predefined label as well as
SQLFORM

-vince

mdipierro

unread,
Jan 15, 2009, 9:02:49 AM1/15/09
to web2py Web Framework
I agree. In 1.56.

mdipierro

unread,
Jan 15, 2009, 11:24:09 AM1/15/09
to web2py Web Framework
I was about to do this when I encountered a logical problem...

db.define_table('table1',SQLField('name',label='Name'))
db.define_table('table2',SQLField('name',label='Name'),SQLField
('other_id',db.table1))

{{=db(db.table1.id==db.table2.other_id).select()}}

this makes a JOIN so the table headers involve two tables.
currently the header is

table1.name, table2.name

if I use label, the header would be:

Name, Name

because a label makes sense only within the context of a table, not
two joint tables.
the current mechanism is to do

{{=db(db.table1.id==db.table2.other_id).select()}}

{{=SQLTABLE(db(db.table1.id==db.table2.other_id).select(),headers=
{'table1.name':'Fisrt table Name', 'table2.name':'Second Table
Name'})}}

which makes

First Table Name, Second Table Name

is this sufficient? Pros Cons Suggestions?

Massimo

vince

unread,
Jan 15, 2009, 4:13:22 PM1/15/09
to web2py Web Framework
i guess we can just do the straight forward one and simply output
"Name, Name"
and let the headers array overwrite the default label if it's a join
table.

-vince
Reply all
Reply to author
Forward
0 new messages