Thanks for your response. Using your suggestion of implementing a controller helped me to see that defining the 'content' statement in extracolumns causes SQLTABLE to pass the current record and rc(rowcount) to be used by a controller or function, that can then be used by the A() helper.
- Tom On Nov 6, 6:42 am, Stefaan Himpe <[email protected]> wrote: > tomt wrote: > > I wanted to implement the 'extracolumns' feature of SQLTABLE > > and the example provided in the source code is: > > > :param extracolums = [{'label':A('Extra',_href='#'), > > 'class': '', #class name of the header > > 'width':'', #width in pixels or % > > 'content':lambda row, rc: A('Edit',_href='edit/ > > %s'%row.id), > > 'selected': False #agregate class selected to this > > column > > }] > > > I don't understand this because I didn't define 'row' or 'rc' anywhere > > in my controller, but the content definition worked anyways. > > With lambda you create a function in-place (without giving it a name). > If you write lambda row, rc : ... you say that you define a function > expecting two parameters: "row" and "rc" > > To understand better, you could just as well write the following > equivalent code with a normal function (untested): > > def show_content(row, rc): > return A('Edit', _href='edit/%s'%row.id) > > extracolums = [{'label':A('Extra',_href='#'), > 'class': '', > 'width':'', > 'content': show_content, > 'selected': False > }]

