@cdmx/wappler_ag_grid 1.4.8 → 1.5.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.
Files changed (2) hide show
  1. package/dmx-ag-grid.js +8 -12
  2. package/package.json +1 -1
package/dmx-ag-grid.js CHANGED
@@ -1398,26 +1398,22 @@ dmx.Component('ag-grid', {
1398
1398
  });
1399
1399
  });
1400
1400
  }
1401
-
1402
1401
  if (columnsToCount) {
1403
1402
  columnsToCount.forEach(function (colObj) {
1404
1403
  const col = colObj.field;
1405
1404
  const uniqueValuesToCount = new Set(colObj.unique_values.split(','));
1406
1405
  result[0][col] = 0;
1407
- const countedValues = new Set();
1408
1406
  const uniqueValues = new Set();
1409
1407
 
1410
1408
  rowData.forEach(function (line) {
1411
1409
  const value = line.data[col];
1412
-
1413
- if (line.index < rowData.length && value !== undefined) {
1414
- if (uniqueValuesToCount.has(value.toString()) && !countedValues.has(value)) {
1410
+ if (line.index < rowData.length && value !== undefined && value !== null) {
1411
+ const valueString = value.toString();
1412
+ if (options.columns_to_count_nonunique || uniqueValuesToCount.has(valueString)) {
1415
1413
  result[0][col]++;
1416
- countedValues.add(value);
1417
- }
1418
-
1419
- if (!uniqueValues.has(value)) {
1420
- uniqueValues.add(value);
1414
+ if (!uniqueValues.has(valueString)) {
1415
+ uniqueValues.add(valueString);
1416
+ }
1421
1417
  }
1422
1418
  }
1423
1419
  });
@@ -1454,14 +1450,14 @@ dmx.Component('ag-grid', {
1454
1450
  if ((options.columns_to_sum && options.columns_to_sum.split(',').length > 0) || (options.columns_to_count.length > 0)) {
1455
1451
  let columnsToSum = options.columns_to_sum ? options.columns_to_sum.split(',') : [];
1456
1452
  let columnsToCount = options.columns_to_count;
1457
-
1453
+
1458
1454
  gridConfig.onFilterChanged = function (e) {
1459
1455
  totalRow(e.api, columnsToSum, columnsToCount);
1460
1456
  };
1461
1457
  gridConfig.onFirstDataRendered = function (e) {
1462
1458
  totalRow(e.api, columnsToSum, columnsToCount);
1463
1459
  };
1464
- gridConfig.postSortRows = function (e) {
1460
+ gridConfig.postSortRows = function (e) {
1465
1461
  totalRow(e.api, columnsToSum, columnsToCount);
1466
1462
  };
1467
1463
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",