Reputation: 321
I have a table definition which includes three fields & they are Home Phone, Work Phone, Cell Phone. I want to implement a one search text box using crud.search() to search among the three fields. for example I had the following table
db.define_table('clients',
Field('Name', 'string',unique=True),
Field('Home_Phone', 'integer'),
Field('Work_Phone', 'integer'),
Field('Cell_Phone', 'integer'),
format = '%(Name)s')
so I want to make crud.search() to show only 2 text box for search instead of 4. the first to be for Name & the second to be for phone number fields.
Upvotes: 2
Views: 785
Reputation: 25536
I don't think crud.search
can handle that (without some hacking in the controller to modify its standard output). You are probably better off using SQLFORM.grid
, though even with that, you will still have to create a customized search widget to replace the default widget:
grid = SQLFORM.grid(db.clients, search_widget=my_search_widget, ...)
If you need more help, ask on the Google Group.
Upvotes: 2