Hello, I am trying to block an element while data is loading. I am using Metronic 8 alongside Bootstrap 5. I can succesfully block the element but I cannot release it and i get an error, I created a MVP
async function getModelActivity(modalElem) {
blockModal(modalElem.id);
unblockModal(modalElem.id);
}
function blockSection(HTMLElement) {
const blockElement = new KTBlockUI(HTMLElement);
return blockElement.block();
}
function unblockSection(HTMLElement) {
const blockElement = new KTBlockUI(HTMLElement);
return blockElement.release();
}
function blockModal(selector) {
const longSelector = "#" + selector + " .modal-content";
const elem = document.querySelector(longSelector);
return blockSection(elem);
}
function unblockModal(selector) {
const longSelector = "#" + selector + " .modal-content";
const elem = document.querySelector(longSelector);
return unblockSection(elem);
}
Hi,
Can you please follow Block UI ?
"is not a function" means you are accessing the variables from different scope. Can you make sure that not a block element is accessible when you call it ?
It seems this is not a Metronic issue, it's more likely your code issue.
Regards.
Hi,
Sorry for the late reply. We will check it shortly and get back to you asap.
Regards.