Re: [web2py] SQLFORM.smartgrid. This is a bug?

2012-11-13 Thread Jose


El martes, 13 de noviembre de 2012 02:10:03 UTC-3, marco mansilla escribió:
>
> aren't you missing the db. before table? 
>

 
No, the way I define the table is not necessary

table_1 = db.define_table('table1',
Field('name'),
)

*table_1 *is equals to* db.table1*

Jose

-- 





Re: [web2py] SQLFORM.smartgrid. This is a bug?

2012-11-12 Thread Marco Mansilla
aren't you missing the db. before table?

like

def something():
 grilla = SQLFORM.smartgrid(db.table_1)

and then for the orderby statement should be:

def something():
 grilla = SQLFORM.smartgrid(db.table_1, orderby=db.table_1.field)


that should work.

> Hello
> 
> Suppose we have the following:
> 
> #Model:
> table_1 = db.define_table('table1',
> Field('name'),
> )
> 
> 
> 
> table_2 = db.define_table('table2',
> Field('field1'),
> Field('field2', table_1),
> )
> 
> 
> #Controller:
> 
> def something():
> grilla = SQLFORM.smartgrid(table_1)
> 
> 
> 
> this shows me the grid with records from table1 and a link to another
> grid with table2 records. This is correct.
> 
> But if I do the following:
> 
> def something():
> grilla = SQLFORM.smartgrid(table_1, orderby= table_1)
> 
> 
> The first grid shows good and well ordered, but when trying to
> display records from table2 through the link, can't get the records
> because it is sort of a field belonging to table1
> 
> *Query Not Supported: no such column: table1.name*
> *
> *
> 
> Jose
> 

--