Giter Club home page Giter Club logo

Comments (6)

crucialfelix avatar crucialfelix commented on August 15, 2024 1

It was working fine for me and for other people, but obviously there is still something wrong.

jQuery is included, and if it wasn't then you couldn't do $(document).ready

I will investigate and get a fix asap.

Thanks!

from django-ajax-selects.

crucialfelix avatar crucialfelix commented on August 15, 2024 1

Django changed the naming of the popup window. This is why the handler function didn't catch the callback that updates the inputs.

The other issue was that there are two jquery: Django's and ajax_selects. It's not wise to use Django's, and it only works in the admin. But it does mean having to do a separate wait on djangoJQuery(document).ready(function () { before it can patch the django admin window closer function.

I tried to switch to using the Django's input.on("changed", ...) event handler, but it doesn't get the id nor the string repr.

from django-ajax-selects.

kalevhark avatar kalevhark commented on August 15, 2024

I figured out solution for me. In ajax_select.js added some extra code:

[...]
$(document).ready(function () {
\ extra code goes here
[...]
})(window.jQuery);

Modified ajax_select.js:
ajax_select.js.txt

from django-ajax-selects.

crucialfelix avatar crucialfelix commented on August 15, 2024

Are you using this in the Django admin or on a separate page? It looks like your fix is going to overwrite Django's existing function (if running in admin):

  $(document).ready(function () {

    // extra code for add new fix
    window.dismissAddRelatedObjectPopup = function (win, newId, newRepr) {

from django-ajax-selects.

kalevhark avatar kalevhark commented on August 15, 2024

I'm using Django admin.
Maybe I figured out what is wrong with v3.0.0 ajax_select.js in Django 4.2.8/5.0:
ajax_select.js code in lines 187-209 must by inside
$(document).ready(function () {
<-- here
[...]
});

except:
var input = $("#" + win.name);
must be:
var input = $("#" + win.name.split('__')[0]);

Proposed solution of ajax_select.js attached.
Sorry about my weak knowledge of Javascript!

ajax_select.txt

from django-ajax-selects.

crucialfelix avatar crucialfelix commented on August 15, 2024

Release tommorrow

from django-ajax-selects.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.