Documentation not accurate for 5.0? mdb.Toast.getInstance().


Topic: Documentation not accurate for 5.0? mdb.Toast.getInstance().show gives javascript error

triklimops-org pro premium priority asked 3 years ago

*_Expected behavior_*Toast to popup as documented on https://mdbootstrap.com/docs/standard/components/toasts/#docsTabsAPI

*_Actual behavior_*Toast doesnt popup and we get a javascript error. We have noticed similar issues on almost everything we use. It seems like when the upgrade to 5.0 occurred, the website wasn't updated with new code snippets that work? For example, when using a select field, it should be easy but we got the same "null" error. We found one of the examples used entirely different javascript than the API document said to use. When we changed it, it worked. Very frustrating when none of the features work without hours of trial and error.

Here are the ones I have tried and not one of them has worked as documented:

  1. Selects (drop downs)
  2. inputs
  3. datetime picker
  4. date picker
  5. time picker
  6. popconfirm
  7. toasts

Resources (screenshots, code snippets etc.)enter image description here

HTML Code:enter image description here

JavaScript codeenter image description here


triklimops-org pro premium priority answered 3 years ago

I was able to figure out what was going on. We had the reference to the mdb.min.js file in the header. I moved it to the bottom of the file and for some reason everything started working for us. I'm not sure why, I have never seen this and I didn't see any documentation saying this was important, but it seems to be.

<script src="/MDBootstrap/MDB5/js/mdb.min.js" type="text/javascript"></script>

Michał Duszak staff answered 3 years ago

Hello, could you recreate broken examples in snippets? I tried to use the show() method from the documentation on a toast and it works. https://mdbootstrap.com/snippets/standard/m-duszak/3808310#js-tab-view


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.2
  • Device: Computer
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes