It's easy enough if you have a separate search-form:
searchform = SQLFORM.factory(...)
form = None
if searchform.process().accepted:
form = SQLFORM.grid(...)
If you're wanting to use the built-in grid search tool, you could set the
query to return 0 results unless keywords is in get_vars:
def search_person():
db.person.id.readable = False
query = (db.tenant) if request.get_vars.keywords else (db.tenant.id==0)
...
form = SQLFORM.grid(query = query, headers = headers, create=False,
deletable=False, editable=False, maxtextlength=64, paginate=4)
return dict(form=form)
On Sunday, 2 November 2014 19:08:26 UTC, Wayne Tooley wrote:
>
> Hi Everyone;
> I'm new to web2py and love it. I have a simple question that I can't seem
> to find a simple answer to.
> I want to use SQLFORM.gid but not to load any values unless searched for.
> Maybe I'm using the wrong thing but is there a simple way to do this?
>
> my code is this:
>
> def search_person():
> db.person.id.readable = False
> query = (db.tenant)
> fields = (db.person.name)
> headers = {'db.person.name': 'Name'}
> grid =False #does not work
> form = SQLFORM.grid(query = query, headers = headers, create=False,
> deletable=False, editable=False, maxtextlength=64, paginate=4)
> return dict(form=form)
>
> any help or examples would be appreciated.....
>
> Regards,
>
> Wayne
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.