thanks Anthony,

Javascript didn't work - where does it go?  Tried both in <script> within 
html page, and in controller but didn't do anything.

below works but is it a good way to write search?

(1) First create regular full query that shows in default results (all).
(2) Then within the "form", get search_term, and recreate query with that 
additional filter.

Alex

## Regular default results user sees on entering the web page. No filter.
  my_connection_requests_i_sent_query = ((db.Role.superObjectID == 
db.auth_user.superObjectID) & (auth.user_id != db.auth_user.id) & 
(db.Role.relationshipID == db.Relationship.id) & 
(db.Relationship.relationshipType == 6) & (db.Relationship.relationshipType 
== db.RelationshipType.id) & (db.Role.roleType == db.RoleType.id) & 
(db.Role.created_by == auth.user_id))   
    form  = SQLFORM.factory(Field('key')).process()
   if form.accepted and form.vars.key:
       search_term = form.vars.key   
                ## below is search plus has new search_term filter
       my_connection_requests_i_sent_query = ((db.Role.superObjectID == 
db.auth_user.superObjectID) & (auth.user_id != db.auth_user.id) & 
(db.Role.relationshipID == db.Relationship.id) & 
(db.Relationship.relationshipType == 6) & (db.Relationship.relationshipType 
== db.RelationshipType.id) & (db.Role.roleType == db.RoleType.id) & 
(db.auth_user.first_name.contains(search_term)) & (db.Role.created_by == 
auth.user_id))
   grid = SQLFORM.grid(my_connection_requests_i_sent_query, editable=False, 
create=False, deletable=False, details=False, searchable=False, 
fields=[db.auth_user.first_name, db.auth_user.last_name, db.auth_user.id, 
db.RoleClass.roleType, db.Role.created_on, db.Role.modified_on, db.Role.id, 
db.RoleType.roleType], links = [dict(header='Cancel connection', 
 body=lambda row: A('Withdraw my invitation', 
_href=URL('edit_connection_request', args=row.Role.id), _class='btn'))], 
 maxtextlengths={'RoleType.roleType':200})


-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to