@cdmx/wappler_ag_grid 0.9.2 → 0.9.3
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 +1 -1
- package/dmx-ag-grid.js +21 -7
- package/package.json +1 -1
|
@@ -1867,7 +1867,7 @@
|
|
|
1867
1867
|
variables: [
|
|
1868
1868
|
{
|
|
1869
1869
|
name: '1', optionName: '1', title: 'File Field ID', type: 'text',
|
|
1870
|
-
dataBindings: true, defaultValue: 'csvfile', required: true,
|
|
1870
|
+
dataBindings: true, defaultValue: '"csvfile"', required: true,
|
|
1871
1871
|
help: 'Field ID of the file to import'
|
|
1872
1872
|
}
|
|
1873
1873
|
]
|
package/dmx-ag-grid.js
CHANGED
|
@@ -178,13 +178,17 @@ dmx.Component('ag-grid', {
|
|
|
178
178
|
if (typeof saveColumnStateToStorage === 'function') {
|
|
179
179
|
saveColumnStateToStorage();
|
|
180
180
|
} else {
|
|
181
|
-
console.error('Grid not loaded to perform
|
|
181
|
+
console.error('Grid not loaded to perform save column state');
|
|
182
182
|
}
|
|
183
183
|
}, this);
|
|
184
184
|
},
|
|
185
185
|
resetColumnState: function () {
|
|
186
186
|
dmx.nextTick(function() {
|
|
187
|
-
|
|
187
|
+
const idValue = this.$node.querySelector('dmx-ag-grid > div')?.getAttribute('id') ?? 'Grid not found';
|
|
188
|
+
const currentPageUrl = window.location.origin + window.location.pathname;
|
|
189
|
+
const uniqueId = `${currentPageUrl}_${idValue}`;
|
|
190
|
+
console.log(uniqueId)
|
|
191
|
+
localStorage.removeItem(`columnState_${uniqueId}`);
|
|
188
192
|
let gridInstance = this.refreshGrid();
|
|
189
193
|
this.set('gridInstance', gridInstance);
|
|
190
194
|
}, this);
|
|
@@ -275,13 +279,15 @@ dmx.Component('ag-grid', {
|
|
|
275
279
|
};
|
|
276
280
|
|
|
277
281
|
const fileInput = document.getElementById(fieldId);
|
|
282
|
+
if (!fileInput) {
|
|
283
|
+
console.error('Field having field Id: '+fieldId+' not found.');
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
278
286
|
const file = fileInput.files[0];
|
|
279
|
-
|
|
280
287
|
if (!file) {
|
|
281
288
|
console.error('Please select a file.');
|
|
282
289
|
return;
|
|
283
290
|
}
|
|
284
|
-
|
|
285
291
|
const reader = new FileReader();
|
|
286
292
|
reader.onload = async (e) => {
|
|
287
293
|
const fileData = e.target.result;
|
|
@@ -1154,7 +1160,7 @@ dmx.Component('ag-grid', {
|
|
|
1154
1160
|
|
|
1155
1161
|
|
|
1156
1162
|
if (!gridDiv) {
|
|
1157
|
-
console.error(`Grid container element with ID '${options.id}' not found.`);
|
|
1163
|
+
console.error(`Grid container element with ID '${options.id}'-grid not found.`);
|
|
1158
1164
|
return;
|
|
1159
1165
|
}
|
|
1160
1166
|
|
|
@@ -1162,15 +1168,23 @@ dmx.Component('ag-grid', {
|
|
|
1162
1168
|
gridInstance.destroy();
|
|
1163
1169
|
gridInstance = null;
|
|
1164
1170
|
}
|
|
1171
|
+
const getPageId = () => {
|
|
1172
|
+
const currentPageUrl = window.location.origin + window.location.pathname;
|
|
1173
|
+
const optionsId = options.id+'-grid';
|
|
1174
|
+
const uniqueId = `${currentPageUrl}_${optionsId}`;
|
|
1175
|
+
return uniqueId;
|
|
1176
|
+
};
|
|
1165
1177
|
const gridConfig = {
|
|
1166
1178
|
onGridReady: function (params) {
|
|
1167
1179
|
const columnApi = params.columnApi;
|
|
1168
1180
|
saveColumnStateToStorage = () => {
|
|
1169
1181
|
const columnState = columnApi.getColumnState();
|
|
1170
|
-
|
|
1182
|
+
const pageId = getPageId();
|
|
1183
|
+
localStorage.setItem(`columnState_${pageId}`, JSON.stringify(columnState));
|
|
1171
1184
|
}
|
|
1172
1185
|
function restoreColumnState() {
|
|
1173
|
-
const
|
|
1186
|
+
const pageId = getPageId();
|
|
1187
|
+
const savedColumnState = JSON.parse(localStorage.getItem(`columnState_${pageId}`));
|
|
1174
1188
|
if (savedColumnState) {
|
|
1175
1189
|
columnApi.applyColumnState({
|
|
1176
1190
|
state: savedColumnState,
|