Jim, I have to solve a similar puzzle soon. Here's the approach I'm going to try.
def make_button(this, that): # dummy_button has the text but is lowlighted without an A helper if should_return_dummy_button: return lowlightedbutton else: return workingbutton links = [lambda row: make_button(row.this, row.that. ...)] On Nov 17, 9:39 am, Jim Steil <j...@qlf.com> wrote: > Hi > > I'm using the following to generate custom links for my SQLFORM.smartgrid: > > actions = dict() > nextActions = db(db.requisitionStatus.nextFunctionLabel>0).select() > for nextAction in nextActions: > actions[nextAction.requisitionStatusId] = > dict(label=nextAction.nextFunctionLabel, > > action=nextAction.nextFunction) > links = [lambda row: A(actions[row.requisitionStatusId]['label'], > > _href=URL(actions[row.requisitionStatusId]['action'],args=[row.id]))] > > This is all working fine to generate the buttons I need. My problem is > that for some of my requisitionStatus records I don't want any button at > all to appear for that row. I can't figure out how to do it. I've tried: > > links = [lambda row: A(actions[row.requisitionStatusId]['label'], > > _href=URL(actions[row.requisitionStatusId]['action'],args=[row.id])) if > actions[row.requisitionStatusId]['label'] != '' else None] > > but that just generates a button with the text of 'None'. I'm not that > good with lambda functions and was wondering if there was a way that I > could have no button generated somehow. > > -Jim