Introducing CrudHunt:Open-source Full-stack CRUDs for Next.js by KeenThemes
Browse CrudHunt

GOOD theme BlockUI util


Since I lost one hour on it sad
It works fine on DIVs, but not on other elements (e.g. SELECT or INPUT).
Maybe update the docs by saying "where" it works, because it took me quite a while to debug it - it would correctly let me create the instance, only to be empty with no block/release methods.

Also, maybe you can add into the doc that a simple example

---

const blockUIInstances = {};

function blockIt(id) {
if (blockUIInstances[id]) {
return; // If it already exists, do nothing
}
const targetElement = document.querySelector("#"+id);
if (targetElement) {
blockUIInstances[id] = new KTBlockUI(targetElement);
console.log('KTBlockUI instance:', blockUIInstances[id]);
if (typeof blockUIInstances[id].block === 'function') {
blockUIInstances[id].block(); // Activate the spinner
} else {
console.error(`block() method not found on KTBlockUI instance for target: ${id}`);
}
} else {
console.error(`Element with ID '${id}' not found in the DOM.`);
}
return
}

function releaseIt(id) {
if (blockUIInstances[id]) {
console.log('deleting '+id)
blockUIInstances[id].release(); // Deactivate the spinner
delete blockUIInstances[id]; // Remove the instance
}
return
}

---

so that you can have dynamic ones according to the id, without the need to create static ones


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Your suggestions for improving the documentation to specify the working conditions of the implementation and to include a dynamic example are quite valuable. Lows Adventures 2



Hi,

Yes, you will need to wrap input elements with container div and apply the blockUI on the div element.

Sure, we will update the docs.

Regards.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(