SQLFORM.grid without advanced search

48 views
Skip to first unread message

Gael Princivalle

unread,
Apr 24, 2017, 5:28:03 AM4/24/17
to web2py-users
Hello.

Is it possible to customize a SQLFORM.grid for having only the global search field?
In other words by default when the user click in the global search field another area is displayed that give the possibility to the user to choose in which field he would like to search. I would like to not display this area.

Thanks in advance.

Gael Princivalle

unread,
Apr 25, 2017, 4:49:41 AM4/25/17
to web2py-users
I can certainly do it finding the file that create this line.
Someone knows which file is it?

jQuery('#w2p_query_fields').change();jQuery('#w2p_query_panel').slideDown();

It doesn't matter if it'll delete this slidedown for all the application grids. 

Anthony

unread,
Apr 25, 2017, 9:56:55 AM4/25/17
to web2py-users
SQLFORM.grid(..., advanced_search=False)

More generally, the "searchable" argument can be a callable that executes a custom search, and the "search_widget" argument can be a callable that generates a custom search widget for the UI. With the combination of those two arguments, you can create whatever kind of customized search you want.

Anthony

Anthony

unread,
Apr 25, 2017, 9:59:49 AM4/25/17
to web2py-users
On Tuesday, April 25, 2017 at 4:49:41 AM UTC-4, Gael Princivalle wrote:
I can certainly do it finding the file that create this line.
Someone knows which file is it?

jQuery('#w2p_query_fields').change();jQuery('#w2p_query_panel').slideDown();

If you want to take that approach, you can instead just delete the w2p_query_panel div from the server-side DOM:

grid.element('#w2p_query_panel', replace=None)

That will allow you to continue using the advanced search syntax if desired without getting the advanced search query panel.

Anthony
Reply all
Reply to author
Forward
0 new messages