Spaces:
Running
Running
Clicking on the same miner as selected should unselect it, and clicking on another one should unselect it and select the newly-xclicked--except for clciicking on the checkbox which behaves as expected a selects or unselects only the checbox-associated miner and doesnt affect any other selection(s) - Follow Up Deployment
Browse files- index.html +7 -12
index.html
CHANGED
|
@@ -721,22 +721,15 @@
|
|
| 721 |
checkbox.checked = true;
|
| 722 |
}
|
| 723 |
}
|
| 724 |
-
// Regular click (
|
| 725 |
else {
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
clearAllSelections();
|
| 729 |
selectedMiners.add(minerId);
|
| 730 |
row.classList.add('bg-primary-50', 'dark:bg-primary-900/20');
|
| 731 |
checkbox.checked = true;
|
| 732 |
} else {
|
| 733 |
-
|
| 734 |
-
clearAllSelections();
|
| 735 |
-
if (!checkbox.checked) {
|
| 736 |
-
selectedMiners.add(minerId);
|
| 737 |
-
row.classList.add('bg-primary-50', 'dark:bg-primary-900/20');
|
| 738 |
-
checkbox.checked = true;
|
| 739 |
-
}
|
| 740 |
}
|
| 741 |
}
|
| 742 |
|
|
@@ -850,13 +843,14 @@
|
|
| 850 |
updateSelectionStats();
|
| 851 |
});
|
| 852 |
|
| 853 |
-
//
|
| 854 |
document.querySelectorAll('tbody input[type="checkbox"]').forEach(checkbox => {
|
| 855 |
checkbox.addEventListener('click', function(e) {
|
| 856 |
e.stopPropagation();
|
| 857 |
const row = this.closest('tr');
|
| 858 |
const minerId = row.dataset.minerId;
|
| 859 |
|
|
|
|
| 860 |
if (this.checked) {
|
| 861 |
selectedMiners.add(minerId);
|
| 862 |
row.classList.add('bg-primary-50', 'dark:bg-primary-900/20');
|
|
@@ -865,6 +859,7 @@
|
|
| 865 |
row.classList.remove('bg-primary-50', 'dark:bg-primary-900/20');
|
| 866 |
}
|
| 867 |
|
|
|
|
| 868 |
updateSelectionStats();
|
| 869 |
});
|
| 870 |
});
|
|
|
|
| 721 |
checkbox.checked = true;
|
| 722 |
}
|
| 723 |
}
|
| 724 |
+
// Regular click (single selection behavior)
|
| 725 |
else {
|
| 726 |
+
clearAllSelections();
|
| 727 |
+
if (!selectedMiners.has(minerId)) {
|
|
|
|
| 728 |
selectedMiners.add(minerId);
|
| 729 |
row.classList.add('bg-primary-50', 'dark:bg-primary-900/20');
|
| 730 |
checkbox.checked = true;
|
| 731 |
} else {
|
| 732 |
+
checkbox.checked = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
}
|
| 734 |
}
|
| 735 |
|
|
|
|
| 843 |
updateSelectionStats();
|
| 844 |
});
|
| 845 |
|
| 846 |
+
// Handle checkbox clicks separately from row clicks
|
| 847 |
document.querySelectorAll('tbody input[type="checkbox"]').forEach(checkbox => {
|
| 848 |
checkbox.addEventListener('click', function(e) {
|
| 849 |
e.stopPropagation();
|
| 850 |
const row = this.closest('tr');
|
| 851 |
const minerId = row.dataset.minerId;
|
| 852 |
|
| 853 |
+
// Only modify this miner's selection state
|
| 854 |
if (this.checked) {
|
| 855 |
selectedMiners.add(minerId);
|
| 856 |
row.classList.add('bg-primary-50', 'dark:bg-primary-900/20');
|
|
|
|
| 859 |
row.classList.remove('bg-primary-50', 'dark:bg-primary-900/20');
|
| 860 |
}
|
| 861 |
|
| 862 |
+
lastSelectedIndex = Array.from(document.querySelectorAll('tbody tr')).indexOf(row);
|
| 863 |
updateSelectionStats();
|
| 864 |
});
|
| 865 |
});
|