Thanks, that makes sense.
What am trying to do is this...

*model*
db.define_table('x',
    Field('p', type='string'),
    Field('q', type='string'),
    Field('r', type='text')
    )

This will be displayed in a SQLFORM.grid, with the following caveats:

   1. I do not want to see columns for p, q, and r, but rather format the 
   output in such way that p q r are concatenated.Therefore the grid will look 
   like this:
   |--p+q+r value--|--row buttons--|
   2. When I edit the row, the edit form should display:
   p (in readonly mode)
   q (in read/write mode)
   r (is not displayed)


   - For caveat 1, I achieved that with the grid's links={} option to 
   display what I need, in the format I needed it. Something like this links = 
   [{'header':'Custom stuff', 'body':lambda row: .... }]. This also means that 
   I set all the fields to readable=False. 
   - For caveat 2, I was trying the stuff mentioned in my original post
   






On Thursday, March 20, 2014 12:51:12 AM UTC+5:30, Anthony wrote:
>
> The label is used to label an entire column, so it wouldn't make sense to 
> calculate a different label for every record. What exactly are you trying 
> to do?
>
> On Wednesday, March 19, 2014 2:54:22 PM UTC-4, Kiran Subbaraman wrote:
>>
>> Hello,
>> I am creating a SQLFORM.grid(), and in the update-form for that grid, I 
>> want to display the label value by computing it.
>>
>> Basically, I have this:
>>
>> model:
>> db.define_table('x',
>>     Field('p', type='string'),
>>     Field('q', type='string')
>>     )
>>
>>
>> controller:
>> ....
>>   if blah:
>>      db.x.q.label = lambda row: row.p
>> .....
>>
>>
>> The label is displayed like this '<function <lambda> at 0x0955FF30>'
>> Not sure if this is supported, or I need to change this code?
>> Any help?
>>
>> Thanks,
>> Kiran
>>
>

-- 
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.

Reply via email to