I think you'll need a custom search widget and/or search function (the latter via the "searchable" argument). For details on how the current default search widget is constructed, see https://github.com/web2py/web2py/blob/89832479fccf6bb2d0ef19427bff2ee7f5347807/gluon/sqlhtml.py#L2618. Note, it is built based on the SQLFORM.search_menu static method.
Feel free to open an issue or make a pull request. Anthony On Friday, July 7, 2017 at 8:42:37 AM UTC-4, Matthew J Watts wrote: > > Hi all > > > > I’m having problems trying to tailor the grid to my needs > > I've set up a grid to query my db and it retrieves the data successfully, > great! > > > > Example: def gridquery(): > > grid = SQLFORM.grid((db.MAIN.TaxonID == db.TAXON.TaxonID), field_id = > db.MAIN.MainID, fields=[db.TAXON.TaxonName, db.TAXON.CommonName, > db.TAXON.TaxonomicPhylum]) > > return locals() > > > > However, the search box contains all of the columns in all of the > connected tables. I want to limit the searches only to the fields i have > specified e.g. 'fields=[db.TAXON.TaxonName, db.TAXON.CommonName, > db.TAXON.TaxonomicPhylum])'. > > > > 1. I've tried to do a few things i.e. setting the unwanted search > fields to 'writable = False & readable = False' > > 2. also tried this method [setattr(f, 'readable', False) for f in > mydb if f.name not in ('mydb.field')] > > > > However, this limits the query results - i want to include all the tables > fields in the query results, just not in the searches. > > > > Does anyone have any suggestions? As I understand I might need to build a > custom widget, at my current level this seems rather complicated,is there a > simpler work around?. > > > > Thanks! > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.