Skip to content

Commit b842ac2

Browse files
committed
reset checkboxs status after clicking browser go back button
1 parent 37fbc17 commit b842ac2

File tree

1 file changed

+11
-0
lines changed
  • app/assets/javascripts/administrate_batch_actions

1 file changed

+11
-0
lines changed

app/assets/javascripts/administrate_batch_actions/script.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ var checkboxes = document.querySelectorAll("[data-batch-action-option='checkbox'
33
var selectAllCheckboxes = document.querySelector("[data-batch-action-option='select_all']");
44

55
if (selectAllCheckboxes && checkboxes && buttons) {
6+
7+
window.onpageshow = function(event) {
8+
if (selectedItemIds()) {
9+
checkboxes.forEach(function(checkbox) {
10+
checkbox.checked = false;
11+
});
12+
13+
selectAllCheckboxes.checked = false;
14+
}
15+
};
16+
617
selectAllCheckboxes.addEventListener('click', function(){
718
checkboxes.forEach(function(checkbox) {
819
checkbox.checked = selectAllCheckboxes.checked;

0 commit comments

Comments
 (0)