Buttons Plug-ins

Buttons Plug-ins

ruellaruella Posts: 1Questions: 1Answers: 0

Hi, I have install buttons plug-ins for export data. My table is serverSide=true with multi pages how result.
The problem is that export butto, export only data display in one page and not all data...
Can help me anyone?
Thanks.

Answers

  • aaronwaaronw Posts: 89Questions: 3Answers: 4

    So with server side data, the entire table is not present in the browser. It exists on the server and DT makes AJAX calls to get the data as it needs - pagination, etc. Your 2 purposes ( server-side and export all data) are really the opposite of each other. You may need to wire up a custom button that goes and gets the export data from the server itself in a custom AJAX call.

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Yeah, theres like 100 threads on this. You have two options, a good one and a bad one..

    1. [Good]: Create your own function to export the data, meaning create your own JS, your own server side code, etc,
    2. [Bad]: Add a -1 to the lengthMenu, which will allow the user to display all the data, then they can export it..

    #2 is bad because it completely voids the point of using serverSide, because if they select the All, it will have to query it, render it, then re-render it for the export, so you may as well just have it do it once on the server side then download it

  • allanallan Posts: 63,506Questions: 1Answers: 10,471 Site admin

    Yes - this comes up a lot. I've just written the following which will be published in the FAQs next time I push the site out (probably later today):

    Q. How can I export the whole table when using serverSide and Buttons.
    A. Buttons is a client-side process, so it can only export the data available at the client-side. When server-side processing is enabled, the full data set is not held on the client-side, so only the visible data can be exported. You can either: 1. Use a server-side process to create the files to download (recommended) or 2. Disable server-side processing.

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited November 2015

    Isnt using -1 in the length also annoption? As terrible as it may be, lol

    Someone said that worked

  • allanallan Posts: 63,506Questions: 1Answers: 10,471 Site admin

    It is - but it isn't an option I want to advertise since its pointless :-). -1 with server-side processing has only one upside: if you want to introduce latency into your application, its is a good way to do it.

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Ya, i agree, id disable it in the core js if i were you ;-)

This discussion has been closed.