What format does the data need to be in order for the flash copy/export to work?

What format does the data need to be in order for the flash copy/export to work?

mrd05dmrd05d Posts: 45Questions: 6Answers: 3

I am trying to send a dataset back to client side and pass it to the flash object for export/copy. This doesn't seem to be working properly. What format should the information be in before doing a fnSetText?

From what I understand TableTools was specifically developed for client side but it is important that I keep the traffic down which is why i am using server side processing. Im only passing page by page. I will not be exporting the entire database but only very small subsets. These subsets however will be much larger than the 15 items per page.

Any help on this would be appreciated considering my project may live or die on this detail.

Thanks

Marcus

This question has accepted answers - jump to:

Answers

  • mrd05dmrd05d Posts: 45Questions: 6Answers: 3

    I tried passing the full data object but am sure that is not what needs to be done. I also tried JSON.stringify to create a string that did not work either... I am assuming it needs to be in a specific format but am unsure as to what format it expects.

  • mrd05dmrd05d Posts: 45Questions: 6Answers: 3

    Anyone?

  • allanallan Posts: 63,175Questions: 1Answers: 10,409 Site admin
    Answer ✓

    Hi,

    If you are using server-side processing, then exporting files using TableTools is not something I would recommend. To use TableTools for the file export you would need to load the full data set, at which point any benefit you might gain from server-side processing has been completely eliminated.

    If you need file export and server-side processing you would be must better having the server-side generate the files for you and download them using normal HTTP methods.

    Allan

  • mrd05dmrd05d Posts: 45Questions: 6Answers: 3

    Hey there Allan I do understand your recommendation and have taken it. I eliminated the select all, copy, and export functions on the main datatable since its size will continue to grow and i needed it to run server side processing. That way it only ever shows 1 page of data at 7kb etc...

    I would like to say however, that being able to send an ajax request using ajax.params() to php return a string and in the success handler using set fnSetText() to push the string to the clipboard seemed like it should have been doable. Didn't seem to work for me though.

    Also if I am creating a button for export and it has to grab data from db via ajax and create file for download what's the difference between this and creating a file server side and client pulling the same file from the server? To me it makes no difference other than it would be more seamless for the developer to have the options in tabetools. The amount of traffic seen by server and client would be the same correct?

    What I mean is in my situation i have the main table basically pulling large number of rows in the db. They would use filters to reduce that dataset to maybe a hundred rows on export (exporting subsets). This means they would never load the full dataset only the filtered subset. This export only happens once or twice a week. So for this functional specification in my mind it makes sense to send via ajax and use the already coded flash export if it were possible.

  • allanallan Posts: 63,175Questions: 1Answers: 10,409 Site admin
    Answer ✓

    It should indeed be possible to do what you tried with fnSetText. It just takes the string to be output. However the SWF interface is not documented, so you'd probably need to go through its code to understand how to use it fully.

    Also if I am creating a button for export and it has to grab data from db via ajax and create file for download what's the difference between this and creating a file server side and client pulling the same file from the server?

    Well the first major plus is that you wouldn't need Flash on the client-side. Also I've found the Javascript / Flash communication bridge to be unreliable for large amounts of data. Finally, you would be using the browser's native download options rather than the Flash specific ones.

    Allan

  • mrd05dmrd05d Posts: 45Questions: 6Answers: 3

    Touche I didn't think of those as they aren't too terribly important to my current project but are definitely notable for other implementations.

    Thanks

This discussion has been closed.