all the records ?
if you need to execurte your "test()" function you just need the browser to
"go" to that page. Let's assume that in your controller you have
def index():
grid = grid(db.testtable)
grid[0][1][1].components = [
TAG.button('testbutton', _id="px-delete",_type="button",_href=URL(
'test'))
]
def test():
# delete all records of db.testtable
db(db.testtable.id>0).delete()
redirect(URL('index'))
Assuming that:
- you go to myapp/default/index and see the grid with the button (assuming
the code fragment you posted works for adding a button, didn't test it).
- press that button
- the browser will go to the page myapp/default/test (the button was a
normal link)
- web2py will delete the table
- and you'll be redirected back to your (now empty) grid.
Is it clear ? Is this what you want to achieve ?
--