[web2py] Re: searchable=True

2018-10-15 Thread Andrea Fae'
thank you very much Anthony. You are SUPER. Il giorno lunedì 15 ottobre 2018 14:31:28 UTC+2, Anthony ha scritto: > > def custom_search(fields, keywords): > [generate a DAL query based on fields and keywords] > return query # Will eventually be used like db(query).select(...) > > grid =

[web2py] Re: searchable=True

2018-10-15 Thread Anthony
def custom_search(fields, keywords): [generate a DAL query based on fields and keywords] return query # Will eventually be used like db(query).select(...) grid = SQLFORM.grid(..., searchable=custom_search) The "fields" argument is a list of the DAL field objects from the table used to

[web2py] Re: searchable=True

2018-10-15 Thread Andrea Fae'
Thank you Anthony, but the code is not easy to understand. could you make me an easy example about to create a custom search function? Do I have to write the code in my controller default.py? Or do I have to change the code in the standard file sqlhtml.py (I don't think so). Thank you Il

[web2py] Re: searchable=True

2018-10-14 Thread Anthony
The "searchable" argument can be a function that takes the list of fields in the grid and the submitted keywords and returns a DAL Query object, so you can create a custom search function. For an example, see the default search function: