@cdmx/wappler_ag_grid 1.4.1 → 1.4.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/README.md +2 -1
- package/app_connect/components.hjson +9 -0
- package/dmx-ag-grid.js +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -244,7 +244,8 @@ These configurations help you create organized and logical groupings of columns
|
|
|
244
244
|
The "Total Row Footer" feature allows you to define and display a footer row in a grid or table that shows the totals and counts of specified columns. This can be helpful for summarizing data in your grid and providing users with a quick overview of important statistics.
|
|
245
245
|
|
|
246
246
|
Configuration includes:
|
|
247
|
-
- **Columns To Count**: Specify the columns you want to count in the footer row. Separate column names with commas.
|
|
247
|
+
- **Columns To Count**: Specify the columns you want to count in the footer row. Separate column names with commas. Note: Counts only Unique values by default.
|
|
248
|
+
- **Count Non-Unique**: Enable to count non-unique values.
|
|
248
249
|
- **Columns To Sum**: Specify the columns you want to calculate the sum of in the footer row. Separate column names with commas.
|
|
249
250
|
- **Fixed Footer**: Enables fixed footer totals row. (Default: false)
|
|
250
251
|
|
|
@@ -1330,6 +1330,7 @@
|
|
|
1330
1330
|
"columnsToSum",
|
|
1331
1331
|
"enableFixedFooter",
|
|
1332
1332
|
"fixedFooterBottomPadding",
|
|
1333
|
+
"columnsToCountNonUnique"
|
|
1333
1334
|
],
|
|
1334
1335
|
"noChangeOnHide": true,
|
|
1335
1336
|
"groupEnabler": true,
|
|
@@ -1365,6 +1366,14 @@
|
|
|
1365
1366
|
"unique_values": ""
|
|
1366
1367
|
}
|
|
1367
1368
|
},
|
|
1369
|
+
{
|
|
1370
|
+
"name": "columnsToCountNonUnique",
|
|
1371
|
+
"attribute": "dmx-bind:columns_to_count_nonunique",
|
|
1372
|
+
"title": "Count Non-Unique",
|
|
1373
|
+
"type": "boolean",
|
|
1374
|
+
"defaultValue": false,
|
|
1375
|
+
"initDisplay": "none"
|
|
1376
|
+
},
|
|
1368
1377
|
{
|
|
1369
1378
|
"name": "columnsToSum",
|
|
1370
1379
|
"attribute": "columns_to_sum",
|
package/dmx-ag-grid.js
CHANGED
|
@@ -179,7 +179,8 @@ dmx.Component('ag-grid', {
|
|
|
179
179
|
compact_view_item_height: { type: Number, default: 20 },
|
|
180
180
|
group_config: { type: Array, default: [] },
|
|
181
181
|
columns_to_count: { type: Array, default: [] },
|
|
182
|
-
columns_to_sum: { type: String, default: null }
|
|
182
|
+
columns_to_sum: { type: String, default: null },
|
|
183
|
+
columns_to_count_nonunique: { type: Boolean, default: false }
|
|
183
184
|
},
|
|
184
185
|
|
|
185
186
|
methods: {
|
|
@@ -721,6 +722,9 @@ dmx.Component('ag-grid', {
|
|
|
721
722
|
}
|
|
722
723
|
// comparator for case-insensitive sorting
|
|
723
724
|
const caseInsensitiveComparator = (valueA, valueB) => {
|
|
725
|
+
if (!valueA) {
|
|
726
|
+
return valueB ? -1 : 0;
|
|
727
|
+
}
|
|
724
728
|
return valueA.toLowerCase().localeCompare(valueB.toLowerCase())
|
|
725
729
|
}
|
|
726
730
|
dateFilterParams = {
|
|
@@ -1384,14 +1388,17 @@ dmx.Component('ag-grid', {
|
|
|
1384
1388
|
columnsToCount.forEach(function (colObj) {
|
|
1385
1389
|
const col = colObj.field;
|
|
1386
1390
|
const uniqueValuesToCount = colObj.unique_values.split(',');
|
|
1387
|
-
|
|
1388
1391
|
result[0][col] = 0;
|
|
1389
1392
|
let uniqueValues = new Set();
|
|
1390
1393
|
|
|
1391
1394
|
rowData.forEach(function (line) {
|
|
1392
1395
|
if (line.index < rowData.length) {
|
|
1393
1396
|
const value = line.data[col];
|
|
1394
|
-
if (
|
|
1397
|
+
if (options.columns_to_count_nonunique) {
|
|
1398
|
+
uniqueValues.add(value);
|
|
1399
|
+
result[0][col]++;
|
|
1400
|
+
}
|
|
1401
|
+
else if (!isNaN(value) && uniqueValuesToCount.includes(value.toString()) && !uniqueValues.has(value)) {
|
|
1395
1402
|
uniqueValues.add(value);
|
|
1396
1403
|
result[0][col]++;
|
|
1397
1404
|
} else if (typeof value === 'string' && uniqueValuesToCount.includes(value) && !uniqueValues.has(value)) {
|