Hi, The code I am using is as below - I have 'Approve Selected Corporates', 'Reject Selected Corporates', 'Approve All Corporates' and 'Reject All Corporates' buttons working in the selectable list. I am changing corp_approved boolean column to True or False as per the button on which user clicks. I want to add 'Approve Filtered Corporates' and 'Reject Filtered Corporates' buttons to this which will change the status of only those records which are displayed on applying the search functionality. Please let me know how this can be done:
@auth.requires_login() def ps_corpapproval(): request_id = 10 i = 1 def approve_corp(ids): if not ids: response.flash = 'Please select a corporate to approve' else: for row in ids: db(db.ps_corporate_list.id == row).update(corp_approved = True) return '' def reject_corp(ids): if not ids: response.flash = 'Please select a corporate to reject' else: for row in ids: db(db.ps_corporate_list.id == row).update(corp_approved = False) return '' def approve_all(ids): db((db.ps_corporate_list.request_id == request_id) & (db.ps_corporate_list.merchant_id == i)).update(corp_approved = True) return '' def reject_all(ids): db((db.ps_corporate_list.request_id == request_id) & (db.ps_corporate_list.merchant_id == i)).update(corp_approved = False) return '' corp_form = SQLFORM.grid((db.ps_corporate_list.request_id==request_id)&(db.ps_corporate_list.merchant_id==i), deletable = False, create = False, editable = False, csv = False, paginate = False, selectable = [('Approve Selected Corporates', lambda ids: approve_corp(ids)),('Reject Selected Corporates', lambda ids: reject_corp(ids)), ('Approve All Corporates', lambda ids: approve_all(ids)), ('Reject All Corporates', lambda ids: reject_all(ids))], orderby = ~db.ps_corporate_list.spends, maxtextlength = 200) return dict(corp_form = corp_form) Thanks, Madhavi -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.