@cdmx/wappler_ag_grid 0.2.2 → 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 +35 -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
|
|
|
@@ -118,6 +121,7 @@ dmx.Component('ag-grid', {
|
|
|
118
121
|
// Assuming `value` is a boolean representing the status
|
|
119
122
|
const checked = value==true ? "checked" : "";
|
|
120
123
|
return `
|
|
124
|
+
<div class="col pt-2 pb-1 ps-1 pe-1 d-flex justify-content-center">
|
|
121
125
|
<label class="switch switch-success">
|
|
122
126
|
<input
|
|
123
127
|
type="checkbox" class="switch-input"
|
|
@@ -133,6 +137,7 @@ dmx.Component('ag-grid', {
|
|
|
133
137
|
<i class="bx bx-x"></i>
|
|
134
138
|
</span>
|
|
135
139
|
</label>
|
|
140
|
+
</div>
|
|
136
141
|
`;
|
|
137
142
|
}
|
|
138
143
|
function actionsRenderer(params) {
|
|
@@ -584,8 +589,36 @@ dmx.Component('ag-grid', {
|
|
|
584
589
|
|
|
585
590
|
// Create the export button
|
|
586
591
|
if (exportToCSV) {
|
|
592
|
+
const existingExportButton = document.getElementById('exportButton');
|
|
593
|
+
// If it already exists, just exit the function
|
|
594
|
+
if (existingExportButton) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
587
597
|
const exportButton = document.createElement('button');
|
|
588
|
-
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
|
+
|
|
589
622
|
exportButton.addEventListener('click', () => {
|
|
590
623
|
const params = {
|
|
591
624
|
fileName: 'export.csv', // Set the desired file name here
|
|
@@ -604,12 +637,11 @@ dmx.Component('ag-grid', {
|
|
|
604
637
|
};
|
|
605
638
|
gridConfig.api.exportDataAsCsv(params);
|
|
606
639
|
});
|
|
607
|
-
|
|
608
640
|
// Append the export button to the grid container
|
|
609
641
|
gridContainer.parentNode.insertBefore(exportButton, gridContainer);
|
|
610
|
-
|
|
611
642
|
exportButton.style.marginBottom = '10px';
|
|
612
643
|
}
|
|
644
|
+
|
|
613
645
|
},
|
|
614
646
|
|
|
615
647
|
events: {
|