> def csv():
> import StringIO
> s=StringIO.StringIO()
>
> db(db.mytable.id.belongs(session.records)).select().export_to_csv_field(s)
> return s.getvalue()
Thanks for your help. I could get the tickboxes working but not the
csv-download. Only the headers were downloaded.
In the end I am not going to use the tickboxes, but I still want to be
able to download a csv-file. I have read everything in your book and
a lot of messages on this list but I still cannot get it to work.
I have:
<a href={{URL(r=request,f='csv',vars=dict(query=query))}}>
'Download as csv-file' </a>
in my view and
def csv():
import StringIO
s=StringIO.StringIO()
response.headers['Content-Type']='application/vnd.ms-excel'
db(request.vars.query).select(db.sarua.All,limitby(1,250)).export_to_csv_file(s)
return s.getvalue()
in my controller. But when I click on the link, nothing happens.
I am want to copy the behaviour of the database-admin interface in
this case but I am struggling to figure out how to do it.
Regards
Johann
--
"Every good gift and every perfect gift is from above,
and cometh down from the Father of lights, with whom
is no variableness, neither shadow of turning."
James 1:17
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.