list:reference and SQLFORM.grid

48 views
Skip to first unread message

Yoel Benitez Fonseca

unread,
Apr 21, 2018, 1:32:44 PM4/21/18
to web2py-users
Is the grid search not working witch list:reference ?

for example:

db.define_table('thing',  Field('name', 'string'))
db.define_table('person', Field('name', 'string'), Field('things', 'list:reference thing'))
db.person.things.requires = IS_IN_DB(db, 'thing.id', '%(name)s', multiple=True)

The things fild can't be search by the grid console ?

Paulo

unread,
Jun 25, 2018, 9:02:19 AM6/25/18
to web2py-users
I have the exact same question and can't find an easy solution in the web :/

Fields of the type list:reference with multiple choices don't show up in the smartgrid search engine. Any easy fix for this?

(The "Repertorio" field is a reference of the table with the same name, with multiple choices, but dont show up if we expand the search).

Thanks in advance

Anthony

unread,
Jun 25, 2018, 10:31:32 AM6/25/18
to web2py-users
The default search widget does not support list:reference fields. You can create a custom search widget via the "search_widget" argument, and also specify a custom search query generator via the "searchable" argument. See the SQLFORM.search_menu and SQLFORM.build_query static methods to see how the built-in widget and query generator work.

Anthony
Reply all
Reply to author
Forward
0 new messages