@cdmx/wappler_ag_grid 0.3.8 → 0.3.9
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/app_connect/components.hjson +9 -0
- package/dmx-ag-grid.js +14 -4
- package/package.json +1 -1
|
@@ -970,6 +970,15 @@
|
|
|
970
970
|
help: 'Reload the AG Grid',
|
|
971
971
|
properties : []
|
|
972
972
|
},
|
|
973
|
+
{
|
|
974
|
+
addTitle: 'Update Grid',
|
|
975
|
+
title : 'Update Grid',
|
|
976
|
+
name : 'updateGrid',
|
|
977
|
+
icon : 'fa fa-lg fa-play',
|
|
978
|
+
state : 'opened',
|
|
979
|
+
help: 'Update the AG Grid',
|
|
980
|
+
properties : []
|
|
981
|
+
}
|
|
973
982
|
],
|
|
974
983
|
"children": [],
|
|
975
984
|
"allowed_children": {},
|
package/dmx-ag-grid.js
CHANGED
|
@@ -81,6 +81,12 @@ dmx.Component('ag-grid', {
|
|
|
81
81
|
dmx.nextTick(function() {
|
|
82
82
|
this.refreshGrid();
|
|
83
83
|
}, this);
|
|
84
|
+
},
|
|
85
|
+
updateGrid: function () {
|
|
86
|
+
dmx.nextTick(function() {
|
|
87
|
+
console.log(this.data.gridInstance)
|
|
88
|
+
// this.updateGrid();
|
|
89
|
+
}, this);
|
|
84
90
|
}
|
|
85
91
|
},
|
|
86
92
|
|
|
@@ -96,6 +102,7 @@ dmx.Component('ag-grid', {
|
|
|
96
102
|
let localeText;
|
|
97
103
|
let columnDefs = [];
|
|
98
104
|
let exportToCSV = this.props.export_to_csv;
|
|
105
|
+
let gridInstance = null;
|
|
99
106
|
this.$node.innerHTML = `<div id=${options.id}-grid class="${options.grid_theme}"></div>`;
|
|
100
107
|
if (!rowData || rowData.length === 0) {
|
|
101
108
|
console.error('No row data provided.');
|
|
@@ -646,8 +653,9 @@ dmx.Component('ag-grid', {
|
|
|
646
653
|
return;
|
|
647
654
|
}
|
|
648
655
|
|
|
649
|
-
if (
|
|
650
|
-
|
|
656
|
+
if (gridInstance) {
|
|
657
|
+
gridInstance.destroy();
|
|
658
|
+
gridInstance = null;
|
|
651
659
|
}
|
|
652
660
|
const gridConfig = {
|
|
653
661
|
columnDefs: columnDefs,
|
|
@@ -655,7 +663,7 @@ dmx.Component('ag-grid', {
|
|
|
655
663
|
...gridOptions
|
|
656
664
|
};
|
|
657
665
|
// Create ag-Grid instance
|
|
658
|
-
new agGrid.Grid(gridDiv, gridConfig);
|
|
666
|
+
gridInstance = new agGrid.Grid(gridDiv, gridConfig);
|
|
659
667
|
const gridElement = document.getElementById(options.id+'-grid');
|
|
660
668
|
const gridContainer = gridElement.parentNode;
|
|
661
669
|
// Add an event listener to the grid
|
|
@@ -752,6 +760,7 @@ dmx.Component('ag-grid', {
|
|
|
752
760
|
gridContainer.parentNode.insertBefore(exportButton, gridContainer);
|
|
753
761
|
exportButton.style.marginBottom = '10px';
|
|
754
762
|
}
|
|
763
|
+
return gridInstance;
|
|
755
764
|
|
|
756
765
|
},
|
|
757
766
|
|
|
@@ -775,7 +784,8 @@ dmx.Component('ag-grid', {
|
|
|
775
784
|
update: function (props) {
|
|
776
785
|
this.set('count', this.props.data.length);
|
|
777
786
|
if (!dmx.equal(this.props.data, props.data)) {
|
|
778
|
-
this.refreshGrid();
|
|
787
|
+
let gridInstance = this.refreshGrid();
|
|
788
|
+
this.set('gridInstance', gridInstance);
|
|
779
789
|
}
|
|
780
790
|
},
|
|
781
791
|
});
|