• Resolved samthedev

    (@samthedev)


    Hello Tobias,

    Thank you so much for this wonderful plugin. It’s full of features and super light.

    We’ve been using it for a while and noticed that when someone clicks on copy/csv/excel/pdf buttons, the plugin generates the entire list of entries.

    Is it possible to control the number of entries generated, such that if am on page 5, the csv generated is only for the entries/rows on page 5 as opposed to the entire list of entries?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Yes, that should be possible, but the Buttons will then have to be configured manually.
    Let’s start with a test for the CSV button. Please add this to the “Custom Commands” text field on the table’s “Edit” screen:

    "buttons": [ { "extend": "csv", "exportOptions': { "modifier": { "page": "current" } } } ]
    

    Regards,
    Tobias

    Thread Starter samthedev

    (@samthedev)

    Thank you for the prompt response Tobias,

    Unfortunately that code snippet didn’t work, it seems to wipe out all the buttons and pagination. But it gave me some clues and I ended up with the following working code for all the buttons:

    "buttons": [
              {
                extend: 'copy',
                exportOptions: {
                    columns: ':visible',
                    rows: ':visible'
                }
            },
            {
                extend: 'print',
                exportOptions: {
                    columns: ':visible',
                    rows: ':visible'
                }
            },
            {
                extend: 'csv',
                exportOptions: {
                    columns: ':visible',
                    rows: ':visible'
                }
            },
            {
                extend: 'excel',
                exportOptions: {
                    columns: ':visible',
                    rows: ':visible'
                }
            },
            {
                extend: 'pdf',
                exportOptions: {
                    columns: ':visible',
                    rows: ':visible'
                }
            },
     ]

    The only bit remaining is to figure out how to enable server side processing. This would enable us to fetch only a subset of rows at a time. Is that currently possible with TablePress?

    • This reply was modified 2 years, 6 months ago by samthedev.
    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, yes, I had a wrong quotation mark (single instead of double) in my example. It should have been

    "buttons": [ { "extend": "csv", "exportOptions": { "modifier": { "page": "current" } } } ]
    

    But your solution is indeed even better as mine likely only covers the pagination case, but not e.g. filtering.

    Good to hear that you found this! Thanks for sharing it!

    Best wishes,
    Tobias
    ?
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Thread Starter samthedev

    (@samthedev)

    Already given 5 stars. Thank you once more for the assistance!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks, I really appreciate it!

    Best wishes,
    Tobias

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    just saw that I totally forgot about replying regarding server side processing: Sorry, that’s not currently possible with TablePress. I do however plan to add support for this in TablePress 2.0, likely as a premium feature.

    Best wishes,
    Tobias

    Thread Starter samthedev

    (@samthedev)

    That would be wonderful!

    I presume the feature would include server & client side ajax-powered pagination for large tables.

    Looking forward to it. Is there a waiting list that I can enroll for this?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, the client would send AJAX requests to only retrieve the data that is necessary. One this is finished, I’ll release TablePress 2.0, for which you will see an update notification on your site, and where you’ll then also find more information about this. In addition, I’ll post more on tablepress.org and on TablePress’ Twitter account @TablePress, so watch those too.

    Best wishes,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Print Current Page/Search results’ is closed to new replies.