Fixed some issues when navigating back in history with Turbo.

This commit is contained in:
Jan Böhmer 2022-07-31 21:47:31 +02:00
parent e26f6e5394
commit ab179a8b71
2 changed files with 8 additions and 3 deletions

View file

@ -27,7 +27,8 @@ class TristateHelper {
registerTriStateCheckboxes() {
//Initialize tristate checkboxes and if needed the multicheckbox functionality
document.addEventListener("turbo:load", () => {
const listener = () => {
$(".tristate").tristate( {
checked: "true",
unchecked: "false",
@ -44,7 +45,10 @@ class TristateHelper {
//@ts-ignore
$('.tristate:checkbox', $row).tristate('state', new_state);
});
})
}
document.addEventListener("turbo:load", listener);
document.addEventListener("turbo:render", listener);
}
}