Skip to content
Snippets Groups Projects

feature: update sib-display on form save

1 file
+ 14
3
Compare changes
  • Side-by-side
  • Inline
+ 14
3
@@ -3,9 +3,9 @@ document.addEventListener('DOMContentLoaded', function (event) {
const rightMenus = Array.from(document.querySelectorAll('nav.jsRightMenu'));
const viewsContainer = Array.from(document.querySelectorAll('.views-container'));
window.addEventListener('navigate', (event) => {
//- View change event
});
//- View change event
// window.addEventListener('navigate', (event) => {
// });
//- Toggle sub-menus
menuWrappers.forEach(menuWrapper => {
@@ -25,4 +25,15 @@ document.addEventListener('DOMContentLoaded', function (event) {
})
});
//- Watch every sib-forms & update data-src of linked sib-display
document.querySelectorAll('sib-form[data-src], sib-form[bind-resource]').forEach(function(el) {
el.addEventListener("save", function() {
let dataSrc = el.getAttribute('data-src');
document.querySelectorAll('sib-display[data-src="'+dataSrc+'"]').forEach(function(e) {
e.setAttribute('data-src', dataSrc);
});
});
});
});
\ No newline at end of file
Loading