@cdmx/wappler_ag_grid 0.3.7 → 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 +11 -2
- package/dmx-ag-grid.js +15 -6
- package/package.json +1 -1
|
@@ -179,10 +179,10 @@
|
|
|
179
179
|
},
|
|
180
180
|
{
|
|
181
181
|
"name": "rowSelection",
|
|
182
|
-
"attribute": "
|
|
182
|
+
"attribute": "row_selection",
|
|
183
183
|
"title": "Row Selection",
|
|
184
184
|
"type": "droplist",
|
|
185
|
-
"defaultValue": '
|
|
185
|
+
"defaultValue": 'multiple',
|
|
186
186
|
"values": [
|
|
187
187
|
{title: 'Single', value: 'single'},
|
|
188
188
|
{title: 'Muliple', value: 'multiple'}
|
|
@@ -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
|
@@ -18,7 +18,7 @@ dmx.Component('ag-grid', {
|
|
|
18
18
|
data: { type: Array, default: [] },
|
|
19
19
|
dom_layout: { type: String, default: 'autoHeight' },
|
|
20
20
|
enable_cell_text_selection: { type: Boolean, default: true },
|
|
21
|
-
row_selection: { type: String, default: '
|
|
21
|
+
row_selection: { type: String, default: 'multiple' },
|
|
22
22
|
suppress_row_deselection: { type: Boolean, default: false },
|
|
23
23
|
pagination: { type: Boolean, default: true },
|
|
24
24
|
pagination_page_size: { type: Number, default: 20 },
|
|
@@ -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.');
|
|
@@ -638,7 +645,6 @@ dmx.Component('ag-grid', {
|
|
|
638
645
|
actionsRenderer: actionsRenderer
|
|
639
646
|
}
|
|
640
647
|
};
|
|
641
|
-
|
|
642
648
|
const gridDiv = document.getElementById(options.id+'-grid');
|
|
643
649
|
|
|
644
650
|
|
|
@@ -647,8 +653,9 @@ dmx.Component('ag-grid', {
|
|
|
647
653
|
return;
|
|
648
654
|
}
|
|
649
655
|
|
|
650
|
-
if (
|
|
651
|
-
|
|
656
|
+
if (gridInstance) {
|
|
657
|
+
gridInstance.destroy();
|
|
658
|
+
gridInstance = null;
|
|
652
659
|
}
|
|
653
660
|
const gridConfig = {
|
|
654
661
|
columnDefs: columnDefs,
|
|
@@ -656,7 +663,7 @@ dmx.Component('ag-grid', {
|
|
|
656
663
|
...gridOptions
|
|
657
664
|
};
|
|
658
665
|
// Create ag-Grid instance
|
|
659
|
-
new agGrid.Grid(gridDiv, gridConfig);
|
|
666
|
+
gridInstance = new agGrid.Grid(gridDiv, gridConfig);
|
|
660
667
|
const gridElement = document.getElementById(options.id+'-grid');
|
|
661
668
|
const gridContainer = gridElement.parentNode;
|
|
662
669
|
// Add an event listener to the grid
|
|
@@ -753,6 +760,7 @@ dmx.Component('ag-grid', {
|
|
|
753
760
|
gridContainer.parentNode.insertBefore(exportButton, gridContainer);
|
|
754
761
|
exportButton.style.marginBottom = '10px';
|
|
755
762
|
}
|
|
763
|
+
return gridInstance;
|
|
756
764
|
|
|
757
765
|
},
|
|
758
766
|
|
|
@@ -776,7 +784,8 @@ dmx.Component('ag-grid', {
|
|
|
776
784
|
update: function (props) {
|
|
777
785
|
this.set('count', this.props.data.length);
|
|
778
786
|
if (!dmx.equal(this.props.data, props.data)) {
|
|
779
|
-
this.refreshGrid();
|
|
787
|
+
let gridInstance = this.refreshGrid();
|
|
788
|
+
this.set('gridInstance', gridInstance);
|
|
780
789
|
}
|
|
781
790
|
},
|
|
782
791
|
});
|