Does anyone know how to export all the table not only the displayed ?

Does anyone know how to export all the table not only the displayed ?

algeria199algeria199 Posts: 3Questions: 0Answers: 0
edited June 2011 in TableTools
I read and re-read this part of the form, and didn't find a solution to this recurrent question :

- we have a server-side ignited datatable with pagination.
- we customize the displayed data by filtering with some keywords and do some column sorting.
- when we click on export (to pdf as example), only the first page of the data is exported.

Does anyone knows how to export all the data (shown and not) of the table with the customization that users will do (fiter and sort) ?

Thx in advance

Replies

  • robbiesmith79robbiesmith79 Posts: 16Questions: 0Answers: 0
    Yup, this has been discussed before in the threads. You can only export what you can see... Your two options are to:

    "bServerSide": false,
    "iDisplayLength": -1

    Or if you're dealing with 10's of thousands of rows like I am, you can always save the query to a queue and schedule a cron job to pick it up and save it to file in the background, then send the user to go pick it up.
  • algeria199algeria199 Posts: 3Questions: 0Answers: 0
    thx robbie,

    After reading your comment (wich gived me an idea) and using firebug to see the parameters sent by the datatable to its own script :

    "sEcho=2&iColumns=10&sColumns=........&iDisplayStart=0&iDisplayLength=10&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=.................&bSortable_9=false.....

    I think a working solution (for a better JS developper than me :) ) is to :
    1. Recover this url from the datatble (I didn't yet found the js datatable function that produce it).
    2. change the "iDisplayLength=10" to -1 (or possibly a high number, ex 10000)
    3. submit it to a script (in my case ignited datatable) with extra parameter, ex: output=csv.
    4. this last one will output a html table that we'll give to table tools for processing.

    Someone will tell me to replace steps 2,3,4 with a personal php script that output csv, He got right.
    But I proposed this method to enhance this good plugin with new features (AND ALWAYS BIG THX TO ALLAN).

    A good JS developper could help us in step 1, I spent a night in echoing datatable properties.

    Any volunteer !!
  • algeria199algeria199 Posts: 3Questions: 0Answers: 0
    Any volunteer !!
This discussion has been closed.