Uncaught TypeError: Cannot read property 'init' of undefined on zTree_v3 library

时光毁灭记忆、已成空白 提交于 2019-12-02 07:31:25

This happens because of including js at multiple places. I have encountered the same issue in my Portal page where jquery-1.4.4.min.js and jquery.ztree.core-3.5.js were included many places.

I fixed this issue by removing all references to js from all the portlets on that page and added these js globally in theme/_diff/portal_noraml.vm in the given order.

This error's in your $(document).ready(), and it's because your zTree script hasn't been loaded correctly. "Cannot read property 'init' of undefined" means you wrote something that evaluates as undefined.init - so you know that $.fn.zTree is undefined.

If you check the network tab of your browser's developer tools, you should hopefully see the problem. I'd guess it'll either be a 404 (ie. the src attribute of the <script> tag is incorrect) or a 403 (ie. you need to change the permissions on your zTree file so the web server can read it).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!