That works perfectly! Thank you very much

On Monday, 19 November 2018 14:38:55 UTC, Anthony wrote:
>
> With joins, you have to specify the ID field explicitly:
>
> SQLFORM.grid(..., field_id=db.applics1.id)
>
> Anthony
>
> On Monday, November 19, 2018 at 4:48:14 AM UTC-5, Francis Windram wrote:
>>
>> Hi All,
>>
>> I'm hitting an issue with the selectable field in SQLFORM.grid.
>>
>> I have a controller including a grid generated from a join on three 
>> tables as follows:
>>
>> applics_fields = ['first_name', 'last_name', 'email', 'rank', 'nerc_elig'
>> , 'cv', 'coverletter', 'refletter1',
>>                       'refletter2']
>>     proposals_fields = ['project_title', 'case_partner']
>>     pi_fields = ['first_name', 'last_name']
>>     fields_to_select = [db.applics1[field] for field in applics_fields] + 
>> \
>>                        [db.proposals[field] for field in proposals_fields
>> ] + \
>>                        [db.PIs[field] for field in pi_fields]
>>
>>     grid = SQLFORM.grid((db.applics1.project == db.proposals.id) & (db.
>> proposals.PI_name == db.PIs.id),
>>                         csv=False,
>>                         deletable=False,
>>                         create=False,
>>                         details=False,
>>                         editable=False,
>>                         fields=fields_to_select,
>>                         headers={'PIs.last_name': 'PI Last Name', 
>> 'PIs.first_name': 'PI First Name'},
>>                         selectable=[('Download Public PDFs', lambda ids: 
>> zip_pdfs(ids, track=1))],
>>                         paginate=False)
>>
>> This generates the correct grid in the view, however when I select the 
>> records I want to pass to zip_pdfs(), the ids passed to the function are 
>> those of the PI table, not of the applics1 table.
>>
>> Is there a way to specify from which table it pulls the ids to be 
>> selected and passed to zip_pdfs()?
>>
>> Thanks,
>> Francis
>>
>

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