replicate the server-side data return?

replicate the server-side data return?

mihomesmihomes Posts: 150Questions: 19Answers: 0

Was working a bit tonight adding the ability for users to download table information as a csv file. I am not using table tools, but rather just made my own ajax call and script to retrieve and parse the info.

The thought popped into my head that it would be great if I could some how replicate the call datatables uses to get this information as this would allow my csv to be in exactly the same format as datatables currently presented it. In other words, the sorting, ordering, if they had search terms entered, etc... whatever the current state of datatables was at that time. Something like using the server-side script, but without the draw when the info is returned... then I could process the returned data how I wanted and it would be the same data shown in datatables at that time... in this case making it into a csv file for download.

At the moment I just have a download button which when clicked will go grab and process the information, but it obviously does not have all the parameters that datatables uses so the csv will never be 'exactly' like what is shown to the user in datatables.

I have looked at the table tools examples and it appears it gets the information in some other way... it does not return the same data set as used by datatables (no sorting, filtering, etc is taken into account) so it basically acts exactly the same way my own implementation does.

Hopefully that made sense. Is something like this possible?

Replies

  • mihomesmihomes Posts: 150Questions: 19Answers: 0

    I think I found the answer - no.... http://datatables.net/reference/type/selector-modifier

    Is there any other way around this limitation when using server-side? dt.rows().data() does what I want, but only returns the current page results instead of all. For creating a csv download/archive of the results this will not work.

This discussion has been closed.