diff --git a/changelog/63_UNRELEASED_xxxx.xx.xx.md b/changelog/63_UNRELEASED_xxxx.xx.xx.md index 8f9bc960..27e9bed6 100644 --- a/changelog/63_UNRELEASED_xxxx.xx.xx.md +++ b/changelog/63_UNRELEASED_xxxx.xx.xx.md @@ -4,3 +4,4 @@ - More information on this: Only 1 level is currently supported; creating > 1 level nestings was _never_ possible via the UI/frontend, but not checked/enforced by the backend before `v3.0.0` - so it was potentially possible via the API (or any third party app/tool which utilizes it) to create such a nesting which then made this upgrade to fail - Fixed that the "Stock by-barcode" API routes were broken (thanks @larsverp) - Fixed that it was not possible to select a chore/battery on the corresponding tracking pages by mouse/touch +- Fixed that grouping by columns in tables may caused duplicate groups diff --git a/public/js/grocy.js b/public/js/grocy.js index 1208f6ef..2b997c1e 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -801,6 +801,13 @@ $.extend(true, $.fn.dataTable.defaults, { if ("dataSrc" in rowGroup) { api.rowGroup().dataSrc(rowGroup.dataSrc); + + // Apply fixed order for group column + var fixedOrder = { + pre: [rowGroup.dataSrc, 'asc'] + }; + + api.order.fixed(fixedOrder); } } } @@ -1096,6 +1103,9 @@ $(document).on("click", ".change-table-columns-rowgroup-toggle", function() }; dataTable.rowGroup().enable(false); + + // Remove fixed order + dataTable.order.fixed({}); } else { @@ -1106,6 +1116,12 @@ $(document).on("click", ".change-table-columns-rowgroup-toggle", function() dataTable.rowGroup().enable(true); dataTable.rowGroup().dataSrc(columnIndex); + + // Apply fixed order for group column + var fixedOrder = { + pre: [columnIndex, 'asc'] + }; + dataTable.order.fixed(fixedOrder); } var settingKey = 'datatables_rowGroup_' + dataTable.settings()[0].sTableId;