On Tuesday, August 14, 2018 at 9:59:53 AM UTC-4, Marcelo Huerta wrote:
>
> Is it possible at all to search for values contained in fields defined as
> list:string in the grid search dialog?
>
Technically the search functionality can handle such searches, but for some
reason, the search widget excludes list:-type fields from the list of
searchable fields (unless you are using GAE datastore). Feel free to open a
Github issue for that to be changed.
Note, the grid takes a "search_widget" argument, which allows you to
specify a custom widget. The default widget is SQLFORM.search_menu. You
could create a forked version of that function, allowing list:string fields
to be included even for non-GAE databases. Just remove:
if fields[0]._db._adapter.dbengine == 'google:datastore':
Also, the "searchable" argument can be a callable that converts the search
keywords to a DAL query. The default is SQLFORM.build_query, which for
advanced search ultimately calls the DAL smart_query() function (which can
handle list:-type fields). However, you can provide your own custom query
builder.
Finally, note that if you simply enter a string in the search box and click
"Search" (i.e., don't use the advanced search widget), it *will *search
inside list:string fields. So, you can search list:string fields -- they
just aren't included in the advanced search options.
Anthony
--
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.