@cdmx/wappler_ag_grid 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dmx-ag-grid.js +33 -3
- package/package.json +1 -1
package/dmx-ag-grid.js
CHANGED
|
@@ -69,6 +69,9 @@ dmx.Component('ag-grid', {
|
|
|
69
69
|
this.set('rowData', rowData);
|
|
70
70
|
this.set('columnDefs', columnDefs);
|
|
71
71
|
this.refreshGrid();
|
|
72
|
+
},
|
|
73
|
+
reloadGrid: function () {
|
|
74
|
+
this.refreshGrid()
|
|
72
75
|
}
|
|
73
76
|
},
|
|
74
77
|
|
|
@@ -586,8 +589,36 @@ dmx.Component('ag-grid', {
|
|
|
586
589
|
|
|
587
590
|
// Create the export button
|
|
588
591
|
if (exportToCSV) {
|
|
592
|
+
const existingExportButton = document.getElementById('exportButton');
|
|
593
|
+
// If it already exists, just exit the function
|
|
594
|
+
if (existingExportButton) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
589
597
|
const exportButton = document.createElement('button');
|
|
590
|
-
exportButton.
|
|
598
|
+
exportButton.id = 'exportButton';
|
|
599
|
+
|
|
600
|
+
// Add the icon
|
|
601
|
+
const icon = document.createElement('i');
|
|
602
|
+
icon.classList.add('fas', 'fa-file-csv'); // Use the Font Awesome icon class here
|
|
603
|
+
exportButton.appendChild(icon);
|
|
604
|
+
|
|
605
|
+
// Add the button text
|
|
606
|
+
const buttonText = document.createElement('span');
|
|
607
|
+
buttonText.innerText = ' Export to CSV';
|
|
608
|
+
exportButton.appendChild(buttonText);
|
|
609
|
+
// Add some fancy styles to the button
|
|
610
|
+
exportButton.style.backgroundColor = '#4CAF50';
|
|
611
|
+
exportButton.style.border = 'none';
|
|
612
|
+
exportButton.style.color = 'white';
|
|
613
|
+
exportButton.style.padding = '5px 10px';
|
|
614
|
+
exportButton.style.textAlign = 'center';
|
|
615
|
+
exportButton.style.textDecoration = 'none';
|
|
616
|
+
exportButton.style.display = 'inline-block';
|
|
617
|
+
exportButton.style.fontSize = '14px';
|
|
618
|
+
exportButton.style.borderRadius = '5px';
|
|
619
|
+
exportButton.style.cursor = 'pointer';
|
|
620
|
+
exportButton.style.marginBottom = '10px';
|
|
621
|
+
|
|
591
622
|
exportButton.addEventListener('click', () => {
|
|
592
623
|
const params = {
|
|
593
624
|
fileName: 'export.csv', // Set the desired file name here
|
|
@@ -606,12 +637,11 @@ dmx.Component('ag-grid', {
|
|
|
606
637
|
};
|
|
607
638
|
gridConfig.api.exportDataAsCsv(params);
|
|
608
639
|
});
|
|
609
|
-
|
|
610
640
|
// Append the export button to the grid container
|
|
611
641
|
gridContainer.parentNode.insertBefore(exportButton, gridContainer);
|
|
612
|
-
|
|
613
642
|
exportButton.style.marginBottom = '10px';
|
|
614
643
|
}
|
|
644
|
+
|
|
615
645
|
},
|
|
616
646
|
|
|
617
647
|
events: {
|