Fixed column visibility handling when there is a shadow rowgroup column (fixes #2074)

This commit is contained in:
Bernd Bestel 2022-12-20 22:11:35 +01:00
parent 2ebb9b2cd9
commit f6e0ff11f1
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 8 additions and 6 deletions

View File

@ -9,6 +9,7 @@
### Stock ### Stock
- Quantity unit conversions now support transitive conversions, means the QU hierarchy has now unlimited levels (thanks a lot @esclear) - Quantity unit conversions now support transitive conversions, means the QU hierarchy has now unlimited levels (thanks a lot @esclear)
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
### Shopping list ### Shopping list
@ -16,7 +17,7 @@
### Recipes ### Recipes
- xxx - Fixed that hiding the "Requirements fulfilled" column (table options) on the recipes page didn't work
### Meal plan ### Meal plan
@ -32,7 +33,7 @@
### Tasks ### Tasks
- xxx - Fixed that hiding the "Category" column (table options) on the tasks page didn't work
### Batteries ### Batteries

View File

@ -1029,6 +1029,7 @@ $(".change-table-columns-visibility-button").on("click", function(e)
dataTable.columns().every(function() dataTable.columns().every(function()
{ {
var index = this.index(); var index = this.index();
var indexForGrouping = index;
var headerCell = $(this.header()); var headerCell = $(this.header());
var title = headerCell.text(); var title = headerCell.text();
var visible = this.visible(); var visible = this.visible();
@ -1041,7 +1042,7 @@ $(".change-table-columns-visibility-button").on("click", function(e)
var shadowColumnIndex = headerCell.attr("data-shadow-rowgroup-column"); var shadowColumnIndex = headerCell.attr("data-shadow-rowgroup-column");
if (shadowColumnIndex) if (shadowColumnIndex)
{ {
index = shadowColumnIndex; indexForGrouping = shadowColumnIndex;
} }
var checked = "checked"; var checked = "checked";
@ -1076,12 +1077,12 @@ $(".change-table-columns-visibility-button").on("click", function(e)
<input ' + rowGroupChecked + ' class="custom-control-input change-table-columns-rowgroup-toggle" \ <input ' + rowGroupChecked + ' class="custom-control-input change-table-columns-rowgroup-toggle" \
type="radio" \ type="radio" \
name="column-rowgroup" \ name="column-rowgroup" \
id="column-rowgroup-' + index.toString() + '" \ id="column-rowgroup-' + indexForGrouping.toString() + '" \
data-table-selector="' + dataTableSelector + '" \ data-table-selector="' + dataTableSelector + '" \
data-column-index="' + index.toString() + '" \ data-column-index="' + indexForGrouping.toString() + '" \
> \ > \
<label class="custom-control-label" \ <label class="custom-control-label" \
for="column-rowgroup-' + index.toString() + '">' + title + ' \ for="column-rowgroup-' + indexForGrouping.toString() + '">' + title + ' \
</label > \ </label > \
</div>'; </div>';
} }