I'm assuming it gets the quite-obvious field_id parameter. If none, it just 
gets the first 'id' field of the first table in the join.

On Monday, October 13, 2014 5:38:51 PM UTC+2, Jim S wrote:
>
> I see this was never answered, but I'm looking for the same thing.  How 
> does SQLFORM.grid's 'selectable' determine which field to use for the 
> 'ids'?  I have a left join as well, and it is picking the 'id' field from 
> the wrong table.  Is there a way to specify which table to use?
>
> -Jim
>
> On Monday, March 12, 2012 7:41:18 AM UTC-5, Johann Spies wrote:
>>
>> When using the following grid:
>>
>>     query = ((db.akb_authors.id.belongs(ids))&
>>              (db.akb_authors_article_link.author == db.akb_authors.uuid)&
>>              (db.akb_authors_article_link.article == 
>> db.akb_articles.uuid)&
>>              (db.akb_journal.uuid == db.akb_articles.journal))
>>     left = (db.akb_authors_article_link.on((db.akb_authors.uuid == 
>> db.akb_authors_article_link.author)&
>>              (db.akb_authors.id.belongs(ids))&
>>              (db.akb_authors_article_link.author == db.akb_authors.uuid)&
>>              (db.akb_authors_article_link.article == 
>> db.akb_articles.uuid)&
>>              (db.akb_journal.uuid == db.akb_articles.journal)))
>>     fields = [db.akb_authors.id, db.akb_authors.surname, 
>> db.akb_authors.firstname,
>>               db.akb_authors.name, db.akb_authors.birthdate, 
>> db.akb_authors.gender,
>>               db.akb_authors.race, db.akb_authors.address, 
>> db.akb_journal.title,
>>               db.akb_journal.subject ]
>>     headers = {'akb_journal.title': 'Journal'}
>>     form = SQLFORM.grid(query, fields=fields, maxtextlength = 100,
>>                         deletable = False,
>>                         editable = False,
>>                         details = False,
>>                         create = False,
>>                         headers = headers,
>>                         selectable = lambda ids: hanteer_verfyning(ids),
>>                         orderby = db.akb_authors.auth_id|
>> db.akb_authors.id)
>>
>> the grid use the id's of the akb_articles.  Is there an easy way to 
>> convince it to use the id specified in [fields] in stead?
>>
>> Regards
>> Johann
>> -- 
>> Because experiencing your loyal love is better than life itself, 
>> my lips will praise you.  (Psalm 63:3)
>>
>>

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