Using the query:

*search_text = request.vars.keyword*
*_query = ((db.tbl.person == db.persons.id) & 
(db.persons.l_name.like('%'+str(search_text)+'%')))*

I can select through the db.tbl that have search_text into 
db.persons.l_name. It works fine!

And why not to use grid? So on:

*grid = SQLFORM.grid(_query, fields = fields, links = links, ...)*


But there is a problem with sqlform.grid links. If I use it that way:

*links = [lambda row: A(XML("<i class='fa fa-share'></i>"), _class='btn 
btn-default', _href=URL('default', 'more', args=[row.persons.id]))]*

I have a link to the db.persons table. But I need link has db.tbl.id.

How to reach the goal?

The tables:


*db.define_table('persons',*
*    Field('l_name',      'string', requires=IS_NOT_EMPTY()),*
*    ...*
*    format='%(l_name)s'**    )*

 


*db.define_table('tbl',*
*    Field('person',      'reference persons'),*
*    Field('num',         'integer'),*
*    Field('create_date', 'date'),*
*    ...**    )*
*db.tbl.person.requires  = IS_IN_DB(db, db.persons.id)*

-- 
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.

Reply via email to