mbraak / django-mptt-admin

Django-mptt-admin provides a nice Django Admin interface for Mptt models
https://mbraak.github.io/django-mptt-admin/
Other
294 stars 47 forks source link

$tree.tree is not a function #122

Closed felixSchl closed 8 years ago

felixSchl commented 8 years ago

I keep getting this error in the change list view:

Uncaught TypeError: $tree.tree is not a function

I followed the README and compared with the example projects. I can see no mistake. The scripts seem to load fine, the jQuery('#tree') result seems fine, but it has no tree() method. What could be going on here? I tred v.0.3.3 (c352ec0cc8ce4ca01fff3bec1ae721a209491147) as well as master but to no avail (except in master the error looks a bit different due to minifcation).

felixSchl commented 8 years ago

I just tested v0.3.1 (744bc6cd9d41423090a0bfdfc9b43a5d6a4bf2ac) and it works well, so it must have been introduced somewhere here: https://github.com/mbraak/django-mptt-admin/compare/744bc6cd9d41423090a0bfdfc9b43a5d6a4bf2ac...c352ec0cc8ce4ca01fff3bec1ae721a209491147

mbraak commented 8 years ago

I will try to reproduce the error.

Can you tell me which Django version you are using? And are you perhaps using an admin extension like Django Grappelli?

felixSchl commented 8 years ago

I am on django 1.8 and yeah I am using grapelli. I have not mentioned it because the HTML appears to get loaded correctly and so does the script.

mbraak commented 8 years ago

I tried to reproduce the error in the example project with grappelli 2.7.4 and Django 1.8.11. It all seems to work fine; both for django-mptt-admin 0.3.3 as the master branch.

mbraak commented 8 years ago

You can get the tree is not a function error if the tree.jquery.js is not loaded.

It is also possible that the tree function is connected to the wrong jQuery instance. This can happen if jquery is loaded multiple times.

felixSchl commented 8 years ago

@mbraak You were right, it was due to a duplicate jquery dependency. I was bringing in jquery when I set up autocomplete_light at the time. Thank you for your time and my apologies for the noise. May it help someone else :)

YDA93 commented 2 years ago

I am having this error now. And when I remove jQuery script from html template i get Error while loading the data from the server.

Please help.

YDA93 commented 2 years ago

Ok i placed the script at very top now its working. Sorry.