Topic: Error using Treeview. Treeview.getInstance is not a function

Yiannis Kyriazidis free asked 2 years ago


Im getting a console error trying to access the trreview plugin with message :

Treeview.getInstance is not a function (see attached screenshot).

I have loaded all the necessary files : mdb.min.js mdb-plugins/all.min.js

see screenshot with console message and code enter image description here


Yiannis Kyriazidis free answered 2 years ago


Ok I re-downloaded the library and replaced files and now it works. Crazy !! Thank you.


Yiannis Kyriazidis free answered 2 years ago


i even removed jquery but still the same.


Yiannis Kyriazidis free answered 2 years ago


I tried everything and still no luck . Here are the file that gets loaded in the browser ( request and response) javascript file is there anything wrong here ? enter image description here

enter image description here

enter image description here


Dawid Wajszczuk staff commented 2 years ago

Try using our starter (zip package that you have downloaded with MDB-UI-KIT - without any modifications). Open index.html, copy one example from our documentation https://mdbootstrap.com/docs/standard/plugins/tree-view/, try to get instance of this Treeview and let me know if this works. It is hard to tell what is going wrong from this screenshots.


Yiannis Kyriazidis free answered 2 years ago


I tried both solutions but no luck. Have a look at attached screenshot . When i log in console Treeview it returns a Module {__esModule ...} not an instance with method. So does this have to do with transpiling issue ?error treeview


Dawid Wajszczuk staff commented 2 years ago

There is something wrong with your import of Treeview, because it is Module instead of function. Try adding type="text/javascript" to your script tags with plugins' JS code. If you are importing our code with import statements, try using require statements instead.


Dawid Wajszczuk staff answered 2 years ago


Hi,

Try using mdb.Treeview isntead of Treeview. You can also try importing Treeview with <script type="text/javascript" src="plugins/js/treeview.min.js"></script>. Here is the instruction for plugins installation https://mdbootstrap.com/docs/standard/pro/plugins-installation/. And I will provide snippet showing how to use getInstance, as well: https://mdbootstrap.com/snippets/standard/d-wajszczuk/3290665#js-tab-view.

Keep coding,
Dawid



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: windows desktop
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No