For updating a dynamically generated table I use a temporarily table and a
SQLFORM on that table.
This works fine except the sequence of the fields looks random to me.
I use the following code:
lev_fields_dict= {
Field(
"d"+str(eval('db.%s'%request.vars.lev_table)[date_row.id]['lev_date']).replace("-",
""),
db.local_ev_def[db(db.local_ev.lev_table_name==request.vars.lev_table).select().first().local_ev_def].data_type,
default=eval('db.%s'%request.vars.lev_table)[date_row.id]['lev_value'],
label =
str(eval('db.%s'%request.vars.lev_table)[date_row.id]['lev_date'])
)
for date_row in
eval('db(db.%s)'%request.vars.lev_table).select(
eval('db.%s'%request.vars.lev_table).id,
orderby=eval('db.%s'%request.vars.lev_table).id)
}
db.define_table('form_%s'%request.vars.lev_table, *lev_fields_dict)
form = SQLFORM(eval('db.form_%s'%request.vars.lev_table))
The fields in the temp table have random order. Does anybody know why?
Thanks,
Richard D
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.