@cdmx/wappler_ag_grid 0.3.8 → 0.4.0

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.
@@ -58,6 +58,14 @@
58
58
  "required": true,
59
59
  "help": "Enter Data Source"
60
60
  },
61
+ {
62
+ "name": "gridNoLoad",
63
+ "hasAttribute": "noload",
64
+ "title": "No Auto Load",
65
+ "type": "boolean",
66
+ "defaultValue": "",
67
+ "initValue": true
68
+ },
61
69
  {
62
70
  "name": "grid_theme",
63
71
  "attribute": "grid_theme",
@@ -962,14 +970,23 @@
962
970
  ],
963
971
  actionsScheme: [
964
972
  {
965
- addTitle: 'Reload Grid',
966
- title : 'Reload Grid',
967
- name : 'reloadGrid',
973
+ addTitle: 'Load',
974
+ title : 'Load',
975
+ name : 'loadGrid',
968
976
  icon : 'fa fa-lg fa-play',
969
977
  state : 'opened',
970
- help: 'Reload the AG Grid',
978
+ help: 'Load the AG Grid',
971
979
  properties : []
972
980
  },
981
+ {
982
+ addTitle: 'Reload',
983
+ title : 'Reload',
984
+ name : 'reloadGrid',
985
+ icon : 'fa fa-lg fa-sync',
986
+ state : 'opened',
987
+ help: 'Reload the AG Grid',
988
+ properties : []
989
+ }
973
990
  ],
974
991
  "children": [],
975
992
  "allowed_children": {},
package/dmx-ag-grid.js CHANGED
@@ -8,6 +8,7 @@ dmx.Component('ag-grid', {
8
8
 
9
9
  attributes: {
10
10
  id: { default: null },
11
+ noload: { type: Boolean, default: false },
11
12
  grid_theme: { type: String, default: 'ag-theme-alpine' },
12
13
  column_defs: { type: Array, default: [] },
13
14
  cstyles: { type: Array, default: [] },
@@ -81,6 +82,11 @@ dmx.Component('ag-grid', {
81
82
  dmx.nextTick(function() {
82
83
  this.refreshGrid();
83
84
  }, this);
85
+ },
86
+ loadGrid: function () {
87
+ dmx.nextTick(function() {
88
+ this.refreshGrid();
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 (this.props.gridInstance) {
650
- this.props.gridInstance.destroy(); // Destroy the previous grid instance if it exists
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
 
@@ -774,8 +783,9 @@ dmx.Component('ag-grid', {
774
783
 
775
784
  update: function (props) {
776
785
  this.set('count', this.props.data.length);
777
- if (!dmx.equal(this.props.data, props.data)) {
778
- this.refreshGrid();
786
+ if (!dmx.equal(this.props.data, props.data) && !this.props.noload) {
787
+ let gridInstance = this.refreshGrid();
788
+ this.set('gridInstance', gridInstance);
779
789
  }
780
790
  },
781
791
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",