Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix row highlighting on SelectAll event

dominik-zeglenfdbf3065332d
diff --git a/saleor/static/dashboard/js/components/bulk-actions.js b/saleor/static/dashboard/js/components/bulk-actions.js
index be20d73dd2..9f4e439ea8 100644
--- a/saleor/static/dashboard/js/components/bulk-actions.js
+++ b/saleor/static/dashboard/js/components/bulk-actions.js
@@ -1,7 +1,7 @@
/**
- * This function adds .highlight class on checked table rows on page load.
- * Fixes bug when user checks some items, goes to another page, then goes back
- * in browsing history and some rows are checked but have no .highlight class.
+ * This function adds .highlight class on checked table rows on page load and select all action.
+ * Fixes bug when user checks some items, goes to another page, then goes back in browsing history
+ * and some rows are checked but have no .highlight class.
*/
function initCheckedRows () {
$('.select-item:checked:not(#select-all-items)')
@@ -11,6 +11,13 @@ function initCheckedRows () {
.parent()
.addClass('highlight');
});
+ $('.select-item:not(:checked):not(#select-all-items)')
+ .each((itemIndex, item) => {
+ $(item)
+ .parent()
+ .parent()
+ .removeClass('highlight');
+ });
}
function moveSelectAllCheckbox (bulk, selectAllState) {
@@ -61,6 +68,7 @@ function onSelectAll (e) {
const $targetForm = $target.parents('form');
const $items = $targetForm.find('.select-item:not(.select-all)');
$items.prop('checked', $target[0].checked);
+ initCheckedRows();
$target.off('change');
updateSelectedItemsText($target[0].checked);
}