You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mind Bridge <mi...@yahoo.com> on 2005/03/01 00:15:20 UTC

Re: contrib:Table component XML/CSV export

Hi,

> Basically I'd like to have a link with my contrib:Table that would export
> the data as XML or CSV (like displayTag does)
> I know that I could hand-roll such a thing but I was wondering if someone
> had done any work here.

Yes, we are doing that, but unfortunately the code isn't polished enough to
be public.
We have a 'download' link on top of our reports that allows you to download
the data that you see (in CSV, for example).

We have a special page for that that gets initialized with an ITableModel
before it is rendered. The page generates CSV (or XML in your case) based on
the data that the ITableModel gives it. The content type is selected by
modifying getResponseWriter().

If you are using contrib:Table with the source and columns parameters, you
can do the following to get an ITableModel:

Table tbl = (Table) getComponent("table"); // replace this with your
component name
ITableModel model = tbl.getTableModel();

You can do that before transferring control to the page described above and
pass that model to it.

Hope this helps,
-mb

----- Original Message ----- 
From: "J. Matthew Pryor" <jm...@mobiquity.net>
To: <ta...@jakarta.apache.org>
Sent: Tuesday, March 01, 2005 12:24 AM
Subject: contrib:Table component XML/CSV export


> Apologies if this has been covered before. I have extensively googled and
at
> present the list archives are not searchable ;-(
>
> Basically I'd like to have a link with my contrib:Table that would export
> the data as XML or CSV (like displayTag does)
>
> I know that I could hand-roll such a thing but I was wondering if someone
> had done any work here.
>
> I have written a component to generate an SVG document, but it ended up
> being more work that I thought it might
>
> I guess the thing I wonder about are :
>
> * Setting the content type
> * reusing as much of the contrib:Table infrastructure as possible
>
> Anyway if anybody has helpful hints or pointers that'd be great.
>
> J. Matthew Pryor
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org