Try: lambda value, row, name=name: ...
Anthony On Monday, December 23, 2013 11:38:08 AM UTC-5, P T wrote: > > I am using the following for "represent" fields in the table: > *{Field(name, 'integer', default=0, represent = lambda value, row: DIV(value > if value else '-',_class='month', _id=str(row.id) +'.'+name)) for name > infields > } > > > The intention is to use jeditable for which I need a class and an id for > each td element. But, all the td elements in a row are getting the same > month (specifically last month in the list) in the id, e.g. each td element > id is 72.Dec_2014. I am expecting 72.Jan_2014, 72.Feb_2014, > 72.Mar_2014,..., 72.Dec_2014. How should do I modify definition of > represent? > > > Here is complete definition of tables: > > fields=[] > for row in db(db.months).select(): > fields.append(row.effort_month.strftime('%b_%Y')) > > > db.define_table("monthly_projections", > Field('employee', 'reference auth_user', default=auth. > user_id, writable=False), > Field('costcode', 'reference costcodes', notnull=True), > *{Field(name, 'integer', default=0, represent = lambdavalue > , row: DIV(value if value else '-',_class='month', _id=str(row.id) +'.'+ > name)) for name in fields} > ) > > > Thanks for your help, > > PT > -- 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/groups/opt_out.