Hi, and thank you.

I think I also found a solution.

Instead of using dict(header='Link to PDF-File',body=lambda row: A(row.id
,_href=URL('{}{}{}{}{}
{}{}'.format(request.env.web2py_path,'/applications/',request.application,'/static/orders/pdf/','file.pdf',vars=dict(bestellung_id=
row.id))))

I used the direct path: 

dict(header='Link to Lieferschein_PDF',body=lambda row: 
A(row.id,_href=URL('static', 'orders/pdf', 'file.pdf', 
vars=dict(bestellung_id=row.id))))

As usual I was overthinking, thus missing the obvious thing to do...

Am Donnerstag, 5. Juli 2018 09:51:45 UTC+2 schrieb sandeep patel:
>
>     Hello Annika,
>     You can try this.
>     grid  =  SQLFORM.grid(query,selectable=[(' Link to PDF-File ',lambda 
> ids :redirect(URL('default','file.pdf',vars=dict(id=ids))))
>
>     Best/
>
>
>
> On Thu, Jul 5, 2018 at 12:52 PM <[email protected] <javascript:>> wrote:
>
>> Hello,
>>
>> I have my sqlgrid working but would need a link to a pdf file.I already 
>> inserted two links but they are coming from views, so that wasn't a problem.
>>
>> links = [
>>             dict(header='Link to Orderfile',body=lambda row: 
>> A(row.id,_href=URL('bestellungen', 
>> orderfile.xml',vars=dict(bestellung_id=row.id)))),
>>             dict(header='Link to XML-site',body=lambda row: 
>> A(row.id,_href=URL('bestellungen', 
>> 'xml_order.xml',vars=dict(bestellung_id=row.id))))]
>>
>> Is there any way to also link to a file that is stored somwhere? I tried 
>> request but to no avail. 
>>
>> #dict(header='Link to PDF-File',body=lambda row: A(row.id
>> ,_href=URL('{}{}{}{}{}{}{}'.format(request.env.web2py_path,'/applications/',request.application,'/static/orders/pdf/','file.pdf',vars=dict(bestellung_id=
>> row.id))))
>>
>> Thank you,
>> Annika
>>
>> -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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