Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve problem with unset batch checkbox`s after back via browser history #6466

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Resources/public/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ var Admin = {
if (Admin.get_config('USE_ICHECK')) {
Admin.log('[core|setup_icheck] configure iCheck on', subject);

jQuery('input[type="checkbox"]:not(label.btn > input, [data-sonata-icheck="false"]), input[type="radio"]:not(label.btn > input, [data-sonata-icheck="false"])', subject)
var inputs = jQuery('input[type="checkbox"]:not(label.btn > input, [data-sonata-icheck="false"]), input[type="radio"]:not(label.btn > input, [data-sonata-icheck="false"])', subject);
inputs
.iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue'
Expand All @@ -154,6 +155,10 @@ var Admin = {
$(e.target).trigger('change');
});

// In case some checkboxes were already checked (for instance after moving back in the browser's session history), update iCheck checkboxes.
if (subject === window.document) {
setTimeout(function () { inputs.iCheck('update'); }, 0);
}
}
},
/**
Expand Down