PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.37
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.37
51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / widgets / Data_Table / preview-handler.js

preview-handler.js in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.37, at includes/widgets/Data_Table/preview-handler.js

36 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2 (function ($) {
3 $(window).on('elementor:init', () => {
4 elementor.hooks.addAction('panel/open_editor/widget/king-addons-data-table', (panel, model, view) => {
5 elementor.channels.editor.on('king-addons-data-table-export', () => {
6
7 // Retrieve all table rows
8 const rows = view.$el.find('.king-addons-data-table .king-addons-table-row');
9 const data = [];
10
11 // Iterate over each row and collect text from relevant cells
12 rows.each((_, row) => {
13 const cols = row.querySelectorAll('.king-addons-table-text');
14 const rowData = Array.from(cols, col => col.innerText).join(',');
15 data.push(rowData);
16 });
17
18 // Construct CSV content from array of rows
19 const csvContent = data.join('\n');
20
21 // Create a Blob from CSV data and generate a download link
22 const blob = new Blob([csvContent], { type: 'text/csv' });
23 const downloadLink = document.createElement('a');
24 downloadLink.download = 'placeholder.csv';
25 downloadLink.href = URL.createObjectURL(blob);
26 downloadLink.style.display = 'none';
27
28 // Append link to DOM, trigger download, and then remove the link
29 document.body.appendChild(downloadLink);
30 downloadLink.click();
31 document.body.removeChild(downloadLink);
32 URL.revokeObjectURL(downloadLink.href);
33 });
34 });
35 });
36 })(jQuery);