@cdmx/wappler_ag_grid 1.7.3 → 1.7.4
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 +8 -1
- package/app_connect/components.hjson +52 -1
- package/dmx-ag-grid.js +22 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -301,7 +301,7 @@ Configuration includes:
|
|
|
301
301
|
|
|
302
302
|
---
|
|
303
303
|
|
|
304
|
-
# Set Filters
|
|
304
|
+
# Set Filters and Sort Orders
|
|
305
305
|
|
|
306
306
|
The "Set Filters" feature allows you to enable the setting of filters for columns in a user interface. This feature allows to preset filters when the grid is rendered.
|
|
307
307
|
|
|
@@ -314,6 +314,13 @@ Toggle to enable or disable the feature. When enabled, users can set filters for
|
|
|
314
314
|
- **Filter Type**: The type of filter to apply, options available are: "Starts With," "Less Than," "Date From," "Greater Than," "Equals," and "Contains."
|
|
315
315
|
- **Filter Value**: The Value/Filter to be applied.
|
|
316
316
|
|
|
317
|
+
### Set Sort Orders
|
|
318
|
+
Toggle to enable or disable the feature. When enabled, users can set sort orders for columns. (Default: false)
|
|
319
|
+
|
|
320
|
+
**Custom Sort Orders**: A grid that allows you to define custom sort orders.
|
|
321
|
+
- **Field**: The column name to sort.
|
|
322
|
+
- **Sort Order**: Select Ascending or Descending Order for the Field."
|
|
323
|
+
|
|
317
324
|
---
|
|
318
325
|
|
|
319
326
|
# Configure Actions Column
|
|
@@ -1632,7 +1632,7 @@
|
|
|
1632
1632
|
]
|
|
1633
1633
|
},
|
|
1634
1634
|
{
|
|
1635
|
-
"group": "📒 Set Filters",
|
|
1635
|
+
"group": "📒 Set Filters and Sort Orders",
|
|
1636
1636
|
"variables": [
|
|
1637
1637
|
{
|
|
1638
1638
|
"name": "setFilters",
|
|
@@ -1697,6 +1697,57 @@
|
|
|
1697
1697
|
}
|
|
1698
1698
|
}
|
|
1699
1699
|
]
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
"name": "setSortOrders",
|
|
1703
|
+
"title": "Set Sort Orders",
|
|
1704
|
+
"attributeStartsWith": "dmx-bind",
|
|
1705
|
+
"attribute": "set_sort_order",
|
|
1706
|
+
"type": "boolean",
|
|
1707
|
+
"defaultValue": false,
|
|
1708
|
+
"display": "fieldset",
|
|
1709
|
+
"show": ["listCustomSortOrder"],
|
|
1710
|
+
"noChangeOnHide": true,
|
|
1711
|
+
"groupEnabler": true,
|
|
1712
|
+
"help": "Allows setting sort orders for columns",
|
|
1713
|
+
"children": [
|
|
1714
|
+
{
|
|
1715
|
+
"name": "listCustomSortOrder",
|
|
1716
|
+
"attribute": "dmx-bind:csort",
|
|
1717
|
+
"title": "Custom Sort Order",
|
|
1718
|
+
"type": "grid",
|
|
1719
|
+
"jsonFormat": true,
|
|
1720
|
+
"dataBindings": true,
|
|
1721
|
+
"encloseBT": true,
|
|
1722
|
+
"jsonBT": true,
|
|
1723
|
+
"initDisplay": "none",
|
|
1724
|
+
"columns": [
|
|
1725
|
+
{
|
|
1726
|
+
"field": "field",
|
|
1727
|
+
"caption": "Field",
|
|
1728
|
+
"editable": {
|
|
1729
|
+
"type": "text"
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
"field": "sort",
|
|
1734
|
+
"caption": "Sort Order",
|
|
1735
|
+
"editable": {
|
|
1736
|
+
"type": "list",
|
|
1737
|
+
"items": [
|
|
1738
|
+
{"id": "asc", "text": "Ascending"},
|
|
1739
|
+
{"id": "desc", "text": "Descending"}
|
|
1740
|
+
]
|
|
1741
|
+
}
|
|
1742
|
+
"help": "Sort Order for the fields."
|
|
1743
|
+
}
|
|
1744
|
+
],
|
|
1745
|
+
"newRecord": {
|
|
1746
|
+
"field": "",
|
|
1747
|
+
"sort": "asc"
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
]
|
|
1700
1751
|
}
|
|
1701
1752
|
]
|
|
1702
1753
|
},
|
package/dmx-ag-grid.js
CHANGED
|
@@ -27,6 +27,7 @@ dmx.Component('ag-grid', {
|
|
|
27
27
|
cwidths: { type: Object, default: {} },
|
|
28
28
|
ctypes: { type: Array, default: [] },
|
|
29
29
|
cfilters: { type: Array, default: [] },
|
|
30
|
+
csort: { type: Array, default: [] },
|
|
30
31
|
cstatic_select_editors: { type: Object, default: {} },
|
|
31
32
|
cdynamic_select_editors: { type: Object, default: {} },
|
|
32
33
|
cselect_placeholder: { type: String, default: "-" },
|
|
@@ -857,17 +858,17 @@ dmx.Component('ag-grid', {
|
|
|
857
858
|
|
|
858
859
|
if ((displayDataChanges.length > 0) && displayDataChanges.some(change => change.field === params.colDef.field)) {
|
|
859
860
|
const placeholderMap = Object.fromEntries(
|
|
860
|
-
|
|
861
|
+
Object.entries(params.data).map(([field, fieldValue]) => [`%${field}%`, fieldValue !== null ? fieldValue : ''])
|
|
861
862
|
);
|
|
862
863
|
return displayDataChanges.reduce((cellData, change) => {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
864
|
+
if (change.field === params.colDef.field) {
|
|
865
|
+
const placeholders = Object.keys(placeholderMap).join('|');
|
|
866
|
+
const regex = new RegExp(placeholders + '|%[^%]+%', 'g');
|
|
867
|
+
cellData = change.data.replace(regex, match => placeholderMap[match] || '');
|
|
868
|
+
}
|
|
869
|
+
return cellData;
|
|
869
870
|
}, value);
|
|
870
|
-
|
|
871
|
+
}
|
|
871
872
|
|
|
872
873
|
// Check if there's a matching change in dataChanges
|
|
873
874
|
const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
|
|
@@ -1461,6 +1462,19 @@ dmx.Component('ag-grid', {
|
|
|
1461
1462
|
},
|
|
1462
1463
|
onGridReady: (params) => {
|
|
1463
1464
|
const columnApi = params.columnApi.api;
|
|
1465
|
+
if (options.csort && options.csort.length > 0) {
|
|
1466
|
+
let sortModel = options.csort.map(function(sortItem, index) {
|
|
1467
|
+
return {
|
|
1468
|
+
colId: sortItem.field,
|
|
1469
|
+
sort: sortItem.sort,
|
|
1470
|
+
sortIndex: index
|
|
1471
|
+
};
|
|
1472
|
+
});
|
|
1473
|
+
columnApi.applyColumnState({
|
|
1474
|
+
state: sortModel,
|
|
1475
|
+
defaultState: { sort: null }
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1464
1478
|
hideColumn = (fieldToHide) => {
|
|
1465
1479
|
columnApi.setColumnsVisible([fieldToHide], false);
|
|
1466
1480
|
}
|