> I'm trying to make a generic widget that can export whatever records
> are being shown in a DataGrid. I have the code to generate the file
> and to serve it up to the user using cherrypy, but I'm brain farting
> on how to pass the records in to the widget. I want to just be able
> to pass them in via the template like you do with a datagrid. ie $
> {export_records(records).display()}.
>
Hi again. I'm looking at this issue again today, and am no closer to
a solution. I have no problem serving up the file. I plan to format
the data into a string in a controller method and then call:
pylons.response.headers['Content-Type'] = 'application/vnd.ms-excel;'
# or 'application/pdf', etc
pylons.response.headers['Content-Disposition']
='attachment;filename=export.xls'
and then return the string. This serves up the file nicely.
My problem is that I would like to have a generic button that will
work with any data that is currently being displayed in the grid. The
data presented in the grid might have been filtered, and I don't want
to have to keep track of the filter terms and pass them in to the
export widget so it can generate the same list of records...I just
want to pass the same list used to populate the grid widget in to the
export widget and have it available in the defined action controller
method. Then I would use it to format the file and serve it up.
Is this possible? Can someone give me some pointers on how to do
this? Am I missing something obvious? Should I be looking at
creating a widget?
I have a hard time visualizing it, but something makes me think I
would have to store all of the data as json (or something) as a hidden
field in the export button form... hopefully I'm way off. :)
Thanks in advance.
~Sean
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.