Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: LoadingManagement esample

soiware priority asked 1 year ago


I would like to toggle a loading spinner in the page programmatically. I do not understand example in your "Loading Management" page. Here I found:

const myLoader = document.getElementById('myLoaderID');
const loader = new mdb.LoadingManagement(myLoader);
loader.toggle();

So I created a div in my page with id "myLoaderID", a button with onclick event function calling the code above. But I receive this console error:

TypeError: undefined is not a constructor (evaluating 'new mdb.LoadingManagement(myLoader)')

Am I forgetting to load some module? Please can you explain me what is "MDB UI KIT" and if I have to use:

import { Loading } from 'mdb-ui-kit';

And how have I to use this command? I tried to put this code in JS script but I get an error:

SyntaxError: Unexpected token '{'. import call expects exactly one argument.


No instructions found in you search box:

enter image description here

Thank you.


Mateusz Lazaru staff answered 1 year ago


Hi,

There is an error in documentation. The proper constructor is new mdb.Loading, like in this example:

https://mdbootstrap.com/docs/standard/methods/loading-management/#section-js-init


soiware priority commented 1 year ago

Thank you @mlazaru.Maybe the API section too is not updated. In your delay example I read this:

new mdb.LoadingManagement(loadingDelay, { delay: 5000, backdropID: 'delay-backdrop', }) ...loadingDelay.remove();

But in API doc the methods "remove()" doesn't exists. Can we have the complete methods list please?


Mateusz Lazaru staff commented 1 year ago

remove() from this example is not related to LoadingManagement or MDB. It's the default JS method used to remove HTML Elements from DOM.

https://developer.mozilla.org/en-US/docs/Web/API/Element/remove



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.2.0
  • Device: all
  • Browser: all
  • OS: all
  • Provided sample code: No
  • Provided link: No