Hi after trying for a long time I finally managed to do the below changes in SQLHTML.py, represent function.
def represent(field, value, record): f = field.represent if not callable(f): return str(value) n = f.func_code.co_argcount - len(f.func_defaults or []) if getattr(f, 'im_self', None): n -= 1 if n == 1: return f(value) elif n == 2: return f(value, record) #My part of the code elif n == 3: return f(value, record,field) else: raise RuntimeError("field representation must take 1 or 2 args") The above addition to the represent function means we can now highlight some values in a grid by checking if they are equal to the first row's value of the same field. On Wednesday, 10 April 2013 14:12:07 UTC+5:30, Anil Nalamalapu wrote: > > hi, I am trying to change the reprsentation of a field value dynamically > for each fieldname, for this purpose I need to know the fieldname of the > current value that has been passed to the function. Any idea how to achieve > this?? I can manage to write a few lines of code in web2py source itself if > you give me some directions on where to edit. > > this is the code. > for fieldname in db.mytab.fields: > db.mytab.fieldname.represent = lambda x,row:row[fieldname] > > thanks :) > > -- --- 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.