Individual modules with hyphens in the file name fail to loa


Topic: Individual modules with hyphens in the file name fail to load

scottwilliams pro premium priority asked 3 years ago

According to the optimization page when modules are loaded individually they are outside the mdb global. Got it. No problem. Then it says that individually loaded modules will use the same variable name as its file name. Works as expected... until you have a module with hyphens in the file name! How do I call the function of a module named "date-time-picker.min.js"?

Thanks


Dawid Wajszczuk staff commented 3 years ago

Does using datetimepicker not work? If not you can build your own version of UI Kit (the last section at optimization page https://mdbootstrap.com/docs/standard/getting-started/optimization/#section-custom-version-of-mdb-ui-kit). Then you will have the mdb global available to you with only those modules that you have chosen to import.


scottwilliams pro premium priority commented 3 years ago

I get the following error in the console: Uncaught ReferenceError: "datetimepicker is not defined".

My JS looks as follows: const pickerTimeOptions = document.querySelector('#datetimepickerInline'); new datetimepicker(pickerTimeOptions, { timepicker: { format24: true }, });

Everything works until after I select a time and hit OK. Then it hangs.


scottwilliams pro premium priority commented 3 years ago

Had to abandon loading modules individually as there were too many problems with module functionality when loaded outside the "mdb" global space.


Dawid Wajszczuk staff commented 3 years ago

Datetimepicker module should be available under window['date-time-picker']. But it will probably require also timepicker, datepciker modules (or just CSS modules).


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Open

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.1
  • Device: Macbook Pro
  • Browser: Chrome
  • OS: MacOS 12.1
  • Provided sample code: No
  • Provided link: No