Okay
  Public Ticket #3670273
Exporting
Closed

Comments

  • [email protected] started the conversation

    Hi,

    When I click the export to csv or excel buttons above a wptable it only gives me the rows that are visible in the table. How do I make it export all rows regardless of how many are visible in the table?


    Thanks,
    Phil

  •  1,767
    Miloš replied

    Hi Phil,

    Yes, this is one of our Export Tools limitations.

    In short, the main point on which this depends on is if you use server-side processing in your table or not.

    For tables which do not use server-side processing, this will export all the rows regardless of pagination.

    But if you got server-side processing enabled, then only the visible rows get exported.


    Here are more details on this :

    The table tools functionalities are based on a 3rd party HTML5 library and they are not customizable. Unfortunately, the library allows very little “fine-tuning” of the generated files, so font, size, and other properties cannot be changed.

    There are some limitations in this library we will emphasize for your awareness:

    • For tables with server-side processing, only the visible rows will be exported to any format. If you want the entire table to be exported (or copied to a clipboard), you need to choose the “Show All” feature in the “show … entries” block, and then do the export:6992668217.png

    Now, there could be a couple of workarounds, depending how many rows you have in your table.

    For example, if it is a Manual table - we can't disable server-side option for it.

    There is a workaround for that, you can make an SQL Query table to pull the data from the source Manual Table, any editing you do will reflect the source table and vice-versa, but in SQL Query tables you have the ability to disable/enable server-side option.


    First, check in the Manual Table's editing settings, what's the MySQL Table Name.

    8164221316.png

    Then, create a new SQL Query table with a Query like : SELECT * FROM TableName and you will be able to disable server-side option, if it has less than 2 thousand rows.

    2214386845.png

     As mentioned, if your SQL query based table is not bigger than 2.000 rows, you can disable the server-side on SQL tables, and it will work like it does for linked tables, such as Excel, CSV and similar. ( loads all rows in the HTML of the Page regardless of pagination)


    If your table has a bit more than 2000 rows, for example up to 5, 6 thousand rows, you could 'get away' with a custom workaround to increase this row count while keeping the 'toggle' option to disable server-side.

    Here is the way to do it.

    Please go to ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php and around line 3188 you'll see this:

    if (is_array($res_dataRows) && count($res_dataRows) > 2000) {
    4647462986.png

    The lines of code can change during Updates because our Developers add new lines from time to time, so it is best to search for the line in any Code Editor with CTRL+F to get the right line.

    You can change the number 2000 to a value bigger than the number of rows in your table in order to still have that 'toggle option' for server-side processing.

    Another PHP file in this path :

    ../wp-content/plugins/wpdatatables/source/class.wdtconfigcontroller.php

    In this file, please search for this, there should be two occurrences, first one around line 82 as :

    if (count($wpDataTable->getDataRows()) > 2000) {
    6921758130.png

    And second one around line 143:

    if (count($wpDataTable->getDataRows()) > 2000) {
    
    9764402593.png

    That will increase the server-side processing option automatic limit.

    We just advise caution not to increase that number 'too high' to avoid going over the limit what your Hosting Server's PHP Limitations can handle.

    Usually, up to around 5 to 6 thousand rows should pose no significant performance issues, but if you go higher than that data size without server-side processing, you could experience slow loading times.

    You can certainly test to see how a Table behaves on front-end, and if it loads too slow/or freezes the browser's Page, you can go back in the Table's Back-End and enable server-side processing for that Table.


    For tables which have very large number of rows, like more than 6 thousand, at this time we unfortunately don't have a valid solution, other than hitting "Show ALL rows" on the Table, which can cause to a very slow page load, etc, depending on the server performance.


    If you wish to see a solution to export all rows with server-side processing and pagination, you can make a development suggestion.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.


    Let me know how it goes, I hope this helps.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables