Skip to content

Commit fe93bf2

Browse files
committed
Fix issue with massactions only selecting first item
1 parent 312bfd6 commit fe93bf2

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

view/adminhtml/templates/grid/massactions.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ if (empty($massActions)) {
3737
</div>
3838

3939
<form method="post" x-ref="massActionForm">
40-
<input type="hidden" name="selected[]" x-ref="massActionFormIds" />
40+
<template x-for="id in getSelectedIds" :key="id">
41+
<input type="hidden" name="selected[]" :value="id">
42+
</template>
4143
<input type="hidden" name="namespace" value="<?= $escaper->escapeHtml($viewModel->getNamespace()) ?>" />
4244
<input type="hidden" name="loki_redirect_url" value="<?= /* @noEscape */ $viewModel->getCurrentUrl() ?>" />
4345
<?= /* @noEscape */ $block->getBlockHtml('formkey') ?>

view/adminhtml/templates/script/component-partial/mass-actions-component-partial.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use Magento\Framework\View\Element\Template;
2626
return;
2727
}
2828

29-
this.$refs.massActionFormIds.value = selectedIds;
3029
this.$refs.massActionForm.action = this.$el.getAttribute('data-url');
3130
this.$refs.massActionForm.submit();
3231
}

view/adminhtml/templates/script/component-partial/selected-component-partial.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ use Magento\Framework\View\Element\Template;
1313
initSelectedIds() {
1414
this.selectedIds = new Set([]);
1515
},
16+
getSelectedIds() {
17+
return Array.from(this.selectedIds);
18+
},
1619
getSelectedIdCount() {
1720
if (this.selectedIds.has('ALL')) {
1821
return this.totalItems;

0 commit comments

Comments
 (0)