can use the following :-

form=SQLFORM.grid(db.auth_user, create=False, selectable = lambda ids:
del_emp(ids))

def del_emp(ids):
        if not ids:
                response.flash='Please Select the Check-box to Delete'
        else:
                for row in ids:
                        db(db.auth_user.id == row).delete()
                pass
        pass
        return ''

you can see the submit button at the bottom of grid you can select the
multiple check-box at a time and click the submit button it will
delete the all select-able row at a time


On Mar 26, 12:06 pm, Sebastien Stormacq <sebastien.storm...@gmail.com>
wrote:
> Thanks !
>
>
>
>
>
>
>
> On Saturday, March 24, 2012 5:26:52 AM UTC+1, Javier wrote:
>
> > sabsto
>
> > You can use selectable, for example:
>
> > selectable = lambda ids: delete(ids)
> > form=SQLFORM.grid(query,​selectable=selectable)
>
> > def delete(ids):
> >     to_delete=db(db.tabla.id.​belongs(ids))
> >     to_delete.delete()
>
> > On Fri, Mar 23, 2012 at 9:46 PM, Derek <sp1d...@gmail.com> wrote:
>
> >> Or you could avoid javascript, store the IDs of the "deleted" items in
> >> the session and do your own calls to the DAL to delete items.
>
> >> On Friday, March 23, 2012 7:33:42 AM UTC-7, Anthony wrote:
>
> >>> Is it possible to select and delete multiple rows with one button click
> >>>> using SQLFORM.grid ?  (instead of clicking delete on each row)
> >>>> I tried the "selectable" property but this doesn't help to delete.
> >>>> I searched the archive of this group / mailing-list without success
>
> >>> Not out of the box. I suppose you could add a column (via the "links"
> >>> argument) with "delete" checkboxes, and then add a "delete checked" button
> >>> to the page with a Javascript event handler that identifies the checked
> >>> records, submits a request to the server, and then possibly reloads the
> >>> whole page or just the grid via Ajax.
>
> >>> Anthony

Reply via email to