Title: Exporting to a querystring
Last modified: October 12, 2020

---

# Exporting to a querystring

 *  Resolved [charles godwin](https://wordpress.org/support/users/charlesgodwin/)
 * (@charlesgodwin)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/exporting-to-a-querystring/)
 * I want to add a custom button to a publication. I want this button to open a 
   WP page in a new tab and pass the export information (all rows or selected rows)
   as the value in a querystring name/value pair.
 * I’ve got a button to work for the open but how can I get the query string of 
   the records?
 * A bonus question. I’d really like to only send three columns of selected rows,
   not all columns.
 * Here’s what I have so far.
 *     ```
       	"wpda_buttons_custom": [
       		{
       			"text": "Link",
       			"action": "function ( e, dt, node, config ) {  window.open('https://testdb.ogs.on.ca/thurso-test-premium', '_blank'); }"
       		}
       	]
       ```
   

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

 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/exporting-to-a-querystring/#post-13526646)
 * Hi Charles,
 * Here is a link to an example of the javascript code for a custom button:
    [https://code-manager.com/code/?wpda_search_column_code_type=front-end_code](https://code-manager.com/code/?wpda_search_column_code_type=front-end_code)
 * This is for the export button on the Code Manager website.
 * This is how you select all rows:
    table = jQuery(‘#<your-table-id-goes-here>’).
   DataTable(); rows = table.rows(); data = rows.data();
 * This is how you select only selected rows:
    table = jQuery(‘#<your-table-id-goes-
   here>’).DataTable(); rows = table.rows({selected:true}); data = rows.data();
 * And this is the JSON for the Code Manager export publication:
 *     ```
       {
       	"dom": "lBfrtip",
       	"wpda_search_placeholder_prefix": "",
       	"wpda_searchbox": "footer",
       	"select": {
       		"selector": "td:not(.wpda_select)",
       		"style": "multi" 
       	},
       	"wpda_buttons_custom": [
       		{
       			"text": "Download selected code",
       			"className": "cm_button_download",
       			"action": "function ( e, dt, node, config ) { code_manager_export(); }",
       			"titleAttr": "Click row to select or deselect (multiple row selection supported)"
       		}
       	],
       	"initComplete": "function(settings, json) { jQuery('.cm_button_download').tooltip(); }"
       }
       ```
   
 * If you want to export only selected columnm, just add column selection. Here 
   is the documentation:
    [https://wpdataaccess.com/docs/documentation/data-publisher/adding-buttons-premium/#adding-column-selection](https://wpdataaccess.com/docs/documentation/data-publisher/adding-buttons-premium/#adding-column-selection)
 * Does this help?
 * Best regards,
    Peter
 *  Thread Starter [charles godwin](https://wordpress.org/support/users/charlesgodwin/)
 * (@charlesgodwin)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/exporting-to-a-querystring/#post-13527706)
 * Thanks. you’ve given me a lot to think about.
 * BTW I tried the download button on the first URL but nothing happened except 
   the tooltip showed. I had selected the row I wanted.
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/exporting-to-a-querystring/#post-13531883)
 * Thank you for reporting Charles. I forgot to take the url argument into account.
   I fixed it! Can you please try again…
 * Thanks,
    Peter

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

The topic ‘Exporting to a querystring’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/exporting-to-a-querystring/#post-13531883)
 * Status: resolved