• Resolved gatestar

    (@gatestar)


    I have this nearly perfect then discovered that if I filter the records to what is required and then export to csv it only exports the records on the first page.

    I have seen a solution here.
    https://ww.wp.xz.cn/support/topic/export-all-records-ignoring-pagination/

    But assume the server side false effects the filtering as the custom search builder gets removed and everything moves around.

    Do I need to put these back on in the code or is there a better way to do this?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @gatestar,

    You can do this with server-side processing, but you have to create your own custom button. This is explained here:
    https://wpdataaccess.com/2022/03/24/adding-buttons-to-publications-manually/#3-custom-buttons

    If your table is not too large you can also use client-side processing. Your page load might take a little longer but search, sorting and switching pages will be faster. You can just give it a try…

    Does this help?
    Peter

    Thread Starter gatestar

    (@gatestar)

    I will have a look at the server side.

    I have tried with server side switched off and this seems to make it work, but breaks the filtering, so if I do between on a date the records are not found.

    Thread Starter gatestar

    (@gatestar)

    When you say custom button, do I need to write a custom function as I assume the default csv function only gets the loaded records.

    If you could point me in the right direction that would be helpfull.

    Thanks

    Thread Starter gatestar

    (@gatestar)

    I have turned off server side processing and works ok but the filtering for week commencing date field does not work as no records returned no matter what filter I try.

    Thanks

    Thread Starter gatestar

    (@gatestar)

    Ok I figured out the date is not working on client side because my WordPress is converting date to full date Eg “october 5 2022” and not the 2022-10-05 which is in the SQL and the date picker is asking for.

    I would still prefer this to be done on server side in case these tables get large.

    I have been looking on internet at ones like this
    https://datatables.net/forums/discussion/54994/csv-export-with-server-side but maybe a little over my head but will look and have a go.

    Thanks

    Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @gatestar,

    Date search neeeds a valid date format. Your current format works perfectly. Is it acceptable for you to use this format?

    Here is a code example for a custom button:
    https://code-manager.com/code/?wpda_search_column_code_id=38

    This example exports the selected rows only. If you remove the selection it exports your whole table. It does not take the user selection into account. It is currently not possible to use the user selection with server side export. This is only supported with client side processing.

    Does this make sense?

    Best regards,
    Peter

    Thread Starter gatestar

    (@gatestar)

    Hi is there no way to get the filters currently applied and pass to a function that does the export?

    Or change the page length dynamically to all – run the csv export and then change back.

    I ask as not sure what the limit is for client side records, have seen 50,000 somewhere and if that is the case I am fine.

    Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @gatestar,

    There is no hard number for client side processing. If your query returns too many rows, your server runs into a memory error and the request fails. The max number of rows depends on a number of factors. In theory you could fine tune your server to handle a really large number of rows. Practically this makes no sense, as users will leave your browser when a request takes too much time.

    The full export works with client-side processing, with the limitation that it can process a limitated number of rows only. I would not recommend this with a large table when you expect a lot of user, as each request needs to transer your whole table. This can result in a heavy workload for your server!

    To make this work with server-side processing the export file server-side needs to be created on the server. That requires code which is currently not available. Adding the filters to your request is not the only problem. The server needs to process the filters in a clean way. We cannot just send a where clause. That would be extremely vulnerable to sql injection. So we need to take all the different filter options into account and add it to a server-side export feature. That’s a big project!

    Down to earth… Do your users really need this feature? And at what cost? What if you add a comment to the top of your page that informs users about the limitation that exports impact visible rows only? It’s clean, fast and does not slow down your server in any way.

    Does this make sense?
    Peter

    Plugin Contributor Kim L

    (@kimmyx)

    Hi there,

    I’m going to mark this as resolved as we haven’t heard from you in a while.

    Feel free to create a new thread if you have other questions. πŸ™‚

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Export all filtered records.’ is closed to new replies.