The grid below orders the rows by part_description column only the first time the action is called. After that if you click on the header link it orders by pp_part_id foreign key which is not as useful as it could be by part_description. Why the link in the header for that column does not receive the orderby argument passed to the grid? Any help or explanation will be appreciated, thanks. fields = [db.partprice.pp_id, db.partprice.pp_part_id, db.partprice.pp_partnum, db.partprice.pp_supp_id, db.partprice.pp_unit_price, db.partprice.pp_sugg_price, db.partprice.pp_intro_date, db.partprice.pp_term_date, db.partprice.pp_term_id, db.partprice.pp_comment ] headers= {'partprice.pp_id':'Price Id', 'partprice.pp_part_id':'Part', 'partprice.pp_partnum':'Part Number', 'partprice.pp_supp_id':'Supplier', 'partprice.pp_unit_price':'Unit', 'partprice.pp_sugg_price':'Suggested', 'partprice.pp_intro_date':'Introduced', 'partprice.pp_term_date':'Terminated', 'partprice.pp_term_id':'Termination ID', 'partprice.pp_comment':'Comment' }
db.define_table('part', Field('part_id','id'), Field('part_description','string',length=128,label='Description'), Field('part_intro_date','date',default = now,label='Introduced'), Field('part_term_date','date',label='Terminated'), Field('part_term_id','integer',default=0,label='Termination ID'), Field('part_comment','string',label='Comment'), migrate='part.table', format='%(part_description)s' ) db.define_table('partprice', Field('pp_id','id',label='Price Id'), Field('pp_part_id','reference part',label='Part'), Field('pp_partnum','string',length =50,label='Number'), Field('pp_supp_id','reference supplier',label='Supplier'), Field('pp_unit_price','decimal(18,2)',default=0.00,label='Unit'), Field('pp_sugg_price','decimal(18,2)',default=0.00,label='Suggested'), Field('pp_intro_date','date',default=now,label='Introduced'), Field('pp_term_date','date',label='Terminated'), Field('pp_term_id','integer',default=0,label='Termination ID'), Field('pp_comment','string',label='Comment'), migrate=False, format='%(pp_part_id)s' ) left=db.partprice.on(db.part.part_id==db.partprice.pp_part_id) orderby=[db.part.part_description] form=SQLFORM.grid(db.partprice,left=left,fields=fields,headers=headers,orderby=orderby,sortable=True,paginate='all') -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.