I had a custom widget, which broke after some other things were updated.
It was saying:
TypeError: 'undefined' is not a function (evaluating '$('#id_conta
cts_and_people-phonecontact-content_type-object_id-0-label').combo
box()')
Last night, I finally managed to fix it, after noticing that this script (which is injected into the HTML body as many times as required for each widget) began:
$(document).ready(function(){
while others I had seen began:
jQuery(document).ready(function($){
Changing it to the latter form made it work.
The only thing is, I don't really understand what was wrong, or how doing that fixed it.
I understand that a jQuery conflict of some kind meant that jQuery was unable to find the function "combobox()" and that probably this was because of the way the admin template was loading JavaScript files.
But I don't understand what the changes actually mean, or what they do.
I also found that:
django.jQuery(document).ready(function($){
worked. Again, I don't know what that is doing.
If someone can explain what is going on in this example, that would be really helpful.
More generally, this sort of thing (jQuery conflicts) seems to be an almost constant issue for Django developers who create custom widgets. Is there a more general strategy for dealing with it?
Thanks,
Daniele
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment