Nevermind, got it to work like this:
links = [lambda row: A('+',callback=URL('cart_callback',vars=dict(id=row.id,
action='add')))]
On Wednesday, 11 April 2012 13:06:49 UTC-7, greenpoise wrote:
>
> Based on the online example, POS Online Store, I want to add a button to
> add to cart in the SQLFORM.grid. So if my grid goes like this:
>
> def store():
> fields = [db.product.name,db.product.product_code,db.product.
> productcategory,db.product.description,db.product.price]
> orderby =db.product.name
>
>
> links = [lambda row: A('+',_href=URL("default","cart",args=[row.id]))]
> powerusers = auth.has_membership('managers')
>
> grid=SQLFORM.grid(db.product,fields=fields,orderby=orderby,deletable=
> powerusers,editable=powerusers,paginate=10,links=links)
> return dict(grid=grid)
>
> Where and how can I add a button to the grid that would add the product to
> the shopping cart??? the shopping cart is basically the same as Massimo's
> POS Online Store example.
>
> Links this way works but its not adding anything, it is just a link to
> another page, I want to add the product to the cart.
>
>
>
> Thanks
>