More examples

SQLFORM.grid(db.mytable,query=db.mytable.somefield=='somevalue')
SQLFORM.grid(db.mytable,deletable=False) # default True
SQLFORM.grid(db.mytable,editable=False) # default True
SQLFORM.grid(db.mytable,details=False) # default True
SQLFORM.grid(db.mytable,create=False) # default True
SQLFORM.grid(db.mytable,searchable=False) # default True
SQLFORM.grid(db.mytable,sortable=False) # default True
SQLFORM.grid(db.mytable,selectable=lambda ids:
db(db.mytable.id.belongs(ids).delete())

and combinations thereof

On Aug 18, 12:26 pm, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> You used to do
>
> def index():
>       rows=db(db.mytable).select()
>       table = SQLTABLE(rows)
>       return dict(table=table)
> def search():....
> def view(): ...
> def edit(): ...
> def delete(): ...
> etc etc.
>
> Now you can just do
>
> def index():
>       table = SQLFORM.grid(db.mytable)
>       return dict(table=table)
>
> The new syntax out of the box does:
> - one click sorting
> - view, edit, delete buttons (in place view/edit) no need for
> additional code
> - searching
> - pagination
>
> and a few other things that I will explain later.
>
> Try with your tables and try break it.
>
> Works best with the base.css of welcome.
>
> Need to add some security using signed_url will do so soon.
>
> This was been included in trunk because there seems to be a lot of
> code repetition about this.
> This would not happened without great code examples from Bruno, Martin
> and others.
>
> Massimo

Reply via email to