The grid takes a "searchable" argument, which can be a function that generates a DAL query based on the submitted keywords and the fields. For an example, see the default search function: https://github.com/web2py/web2py/blob/baa129f8715a9d126a81e7ce098d349894d65baa/gluon/sqlhtml.py#L1922.
You can also substitute the default search widget with a custom widget via the "search_widget" argument. For an example, see the default widget: https://github.com/web2py/web2py/blob/baa129f8715a9d126a81e7ce098d349894d65baa/gluon/sqlhtml.py#L1955. Anthony On Thursday, April 27, 2017 at 1:03:46 PM UTC-4, Rudy wrote: > > Hi there, > > I have a quotation table which references the company table. When i > created a SQLFORM.grid, I couldn't use the company_name as keyword in the > default search widget as company field in the quotation table is integer > type (id) even though it's displayed as company_name. I can write an action > select_quote_by_name() to address it, but I wonder if there is any simple > way to address this matter while I can still leverage the default search > widget? Thanks in advance! > > db.define_table('company', > Field('company_name', requires=IS_NOT_EMPTY()), > format='%(company_name)s') > db.define_table('quotation', > Field('company', 'reference company'), > Field('project_name', requires=IS_NOT_EMPTY()), > Field('quote_amount', 'double', default=0, writable=False)) > > grid=SQLFORM.grid(db.quotation) > -- 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.