Re: Export CSV from Client

2010-05-21 Thread Dimitrijević Ivan
@Ramon Buckland: Thank you for this solution!

On May 6, 5:08 am, Ramon Buckland  wrote:
> There is a way to achieve this ..
>
> http://downloadify.info/
>
> see below for a jQuery-ified example/
>
> http://stackoverflow.com/questions/2226192/generate-some-xml-in-javas...
>
> This uses a Flash .swf as the download conduit. tatical it seems but also
> functional.
>
> cheers
> r,
>
> On Wed, May 5, 2010 at 10:18 PM, flyingb...@gmail.com
> wrote:
>
>
>
>
>
> > to  save data as a file, you will need to passs the client data to
> > server and server send back the data to download as a cvs.
>
> > On May 5, 12:30 pm, "cho.cabot"  wrote:
> > > I am trying to allow a user to download data he has manipulated in a
> > > GWT application in CSV format by clicking a button.  I do not want to
> > > have to go back to the server to create/download this CSV file since I
> > > already have the data I need for the file in the client.  I did not
> > > see a way to accomplish this in the GWT API, so I went the native
> > > JavaScript route.  I created these methods:
>
> > > private native Object exportOpen() /*-{
> > >         var win = window.open("", "export", "");
> > >         var doc = win.document;
> > >         doc.open("text/csv", "replace");
> > >         return win;
>
> > > }-*/;
>
> > > private native void exportWrite(Object win, String line) /*-{
> > >         win.document.writeln(line);
>
> > > }-*/;
>
> > > private native void exportClose(Object win) /*-{
> > >         win.document.close();
>
> > > }-*/;
>
> > > And when a button is clicked, the following method is called:
>
> > > private void export() {
> > >         Object win = exportOpen();
> > >         // Actual code loops through data and writes lines, but for
> > > example...
> > >         exportWrite(win, "TEST,TEST,TEST");
> > >         exportClose(win);
>
> > > }
>
> > > This code basically works, except for the fact that the output is just
> > > displayed in a new browser window without prompting the user with the
> > > open/save dialog, which is what I was after.
>
> > > Does anyone know how I can get the open/save dialog to be opened for
> > > the user?  Or, is there a way to create and download this data in GWT
> > > without using native JavaScript?
>
> > > Thanks for your help.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > > To post to this group, send email to google-web-toolkit@googlegroups.com
> > .
> > > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com
> > .
> > > For more options, visit this group athttp://
> > groups.google.com/group/google-web-toolkit?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Export CSV from Client

2010-05-05 Thread Ramon Buckland
There is a way to achieve this ..

http://downloadify.info/


see below for a jQuery-ified example/

http://stackoverflow.com/questions/2226192/generate-some-xml-in-javascript-prompt-user-to-save-it

This uses a Flash .swf as the download conduit. tatical it seems but also
functional.

cheers
r,

On Wed, May 5, 2010 at 10:18 PM, flyingb...@gmail.com
wrote:

> to  save data as a file, you will need to passs the client data to
> server and server send back the data to download as a cvs.
>
> On May 5, 12:30 pm, "cho.cabot"  wrote:
> > I am trying to allow a user to download data he has manipulated in a
> > GWT application in CSV format by clicking a button.  I do not want to
> > have to go back to the server to create/download this CSV file since I
> > already have the data I need for the file in the client.  I did not
> > see a way to accomplish this in the GWT API, so I went the native
> > JavaScript route.  I created these methods:
> >
> > private native Object exportOpen() /*-{
> > var win = window.open("", "export", "");
> > var doc = win.document;
> > doc.open("text/csv", "replace");
> > return win;
> >
> > }-*/;
> >
> > private native void exportWrite(Object win, String line) /*-{
> > win.document.writeln(line);
> >
> > }-*/;
> >
> > private native void exportClose(Object win) /*-{
> > win.document.close();
> >
> > }-*/;
> >
> > And when a button is clicked, the following method is called:
> >
> > private void export() {
> > Object win = exportOpen();
> > // Actual code loops through data and writes lines, but for
> > example...
> > exportWrite(win, "TEST,TEST,TEST");
> > exportClose(win);
> >
> > }
> >
> > This code basically works, except for the fact that the output is just
> > displayed in a new browser window without prompting the user with the
> > open/save dialog, which is what I was after.
> >
> > Does anyone know how I can get the open/save dialog to be opened for
> > the user?  Or, is there a way to create and download this data in GWT
> > without using native JavaScript?
> >
> > Thanks for your help.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> > To post to this group, send email to google-web-toolkit@googlegroups.com
> .
> > To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> > For more options, visit this group athttp://
> groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Export CSV from Client

2010-05-05 Thread flyingb...@gmail.com
to  save data as a file, you will need to passs the client data to
server and server send back the data to download as a cvs.

On May 5, 12:30 pm, "cho.cabot"  wrote:
> I am trying to allow a user to download data he has manipulated in a
> GWT application in CSV format by clicking a button.  I do not want to
> have to go back to the server to create/download this CSV file since I
> already have the data I need for the file in the client.  I did not
> see a way to accomplish this in the GWT API, so I went the native
> JavaScript route.  I created these methods:
>
> private native Object exportOpen() /*-{
>         var win = window.open("", "export", "");
>         var doc = win.document;
>         doc.open("text/csv", "replace");
>         return win;
>
> }-*/;
>
> private native void exportWrite(Object win, String line) /*-{
>         win.document.writeln(line);
>
> }-*/;
>
> private native void exportClose(Object win) /*-{
>         win.document.close();
>
> }-*/;
>
> And when a button is clicked, the following method is called:
>
> private void export() {
>         Object win = exportOpen();
>         // Actual code loops through data and writes lines, but for
> example...
>         exportWrite(win, "TEST,TEST,TEST");
>         exportClose(win);
>
> }
>
> This code basically works, except for the fact that the output is just
> displayed in a new browser window without prompting the user with the
> open/save dialog, which is what I was after.
>
> Does anyone know how I can get the open/save dialog to be opened for
> the user?  Or, is there a way to create and download this data in GWT
> without using native JavaScript?
>
> Thanks for your help.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Export CSV from Client

2010-05-05 Thread cho.cabot
I am trying to allow a user to download data he has manipulated in a
GWT application in CSV format by clicking a button.  I do not want to
have to go back to the server to create/download this CSV file since I
already have the data I need for the file in the client.  I did not
see a way to accomplish this in the GWT API, so I went the native
JavaScript route.  I created these methods:

private native Object exportOpen() /*-{
var win = window.open("", "export", "");
var doc = win.document;
doc.open("text/csv", "replace");
return win;
}-*/;

private native void exportWrite(Object win, String line) /*-{
win.document.writeln(line);
}-*/;

private native void exportClose(Object win) /*-{
win.document.close();
}-*/;

And when a button is clicked, the following method is called:

private void export() {
Object win = exportOpen();
// Actual code loops through data and writes lines, but for
example...
exportWrite(win, "TEST,TEST,TEST");
exportClose(win);
}

This code basically works, except for the fact that the output is just
displayed in a new browser window without prompting the user with the
open/save dialog, which is what I was after.

Does anyone know how I can get the open/save dialog to be opened for
the user?  Or, is there a way to create and download this data in GWT
without using native JavaScript?

Thanks for your help.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.