sure. first of all, all callbacks accepts some parameters.
the ondelete takes the table and the id of the deleted row.
If you instead want to play with request.args and vars, a delete request 
looks like

/app/controller/function/delete/table_name/id

so the id of the deleted record is the last argument.

On Friday, June 28, 2013 9:06:58 PM UTC+2, Kyle Flanagan wrote:
>
> I have an SQLFORM.grid w/ an ondelete calling a function 
> customer_delete(). However, the the function is not being called and the 
> records are not actually being deleted from the DB. If I remove the 
> "ondelete=customer_delete" in my grid args, the records are being deleted. 
> The way I understand it, ondelete should delete the record, then call 
> customer_delete, and it's not doing either. Do I have my function 
> definition correct for customer_delete? 
>
>     
> def index():
>     grid = SQLFORM.grid(db.Customer, oncreate=customer_create, ondelete=
> customer_delete)
>     return dict(grid=grid)
>
> def customer_create(form):
>     # add the customer's id into the group table so we can use it for 
> permissions
>     # so the customer's ID is the STRING NAME of the ROLE in the group 
> table
>     from gluon.tools import Auth
>     auth = Auth(db)
>     response.flash = T("Customer added.")
>     auth.add_group(form.vars.id, form.vars.customer_name)
>     
> def customer_delete():
>     # if we delete a customer, remove the group
>     response.flash = "Test"
>     from gluon.tools import Auth
>     auth = Auth(db)
>     response.flash = T(request.get_vars.id)
>     auth.del_group(auth.id_group(role=str(request.get_vars.id)))
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to