0xgareth
0xgareth

Reputation: 621

Adding links to SQLFORM.grid, Web2PY

def index():
gridHome = SQLFORM.grid(db.games, editable=False, create=False, csv=False, deletable=False, details=False, 
links = [lambda row: A('View Post',_href=URL("default","show",args=[row.id]))])
return locals()

I'm trying to add another link to the SQL grid just like the one above. I keep getting a syntax error as i don't know how to write it out.

'Review',_href=URL("default","review",args=[row.id]

That is the link i want to add.

Upvotes: 1

Views: 2287

Answers (1)

salomonderossi
salomonderossi

Reputation: 2188

You were closing the global array before closing brackets of the link

def index():
    gridHome = SQLFORM.grid(db.games, editable=False, create=False, csv=False, deletable=False, details=False, 
                            links = [lambda row: A('View Post',_href=URL("default","show",args=[row.id])), 
                                     lambda row: A('Review',_href=URL("default","review",args=[row.id]))])       

    return locals()

Upvotes: 2

Related Questions