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