django-advanced-filters icon indicating copy to clipboard operation
django-advanced-filters copied to clipboard

Not possible to add another filter in the popup

Open eriktelepovsky opened this issue 3 years ago • 1 comments

Describe the bug Not possible to add another filter field in the popup.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'model admin'
  2. Click on 'Advanced filter'
  3. Click on 'Add another filter'
  4. See error in the Javascript Console

Expected behavior No error in the console and new field added.

Screenshots image

Details (please complete the following information):

  • OS: [doesn't matter, but tried both Mac and Debian]
  • Python version [3.9.8]
  • Django version [3.1.2]
  • django-advanced-filters version [1.3.0]
  • Browser [Chrome 96.0.4664.110, Safari 14.1.2]
  • I don't use Grappelli

Additional context JavaScript Console: image

Possible fix It works when I comment line 142 in advanced-filters.js:

$('.form-row input.query-value').each(function() {
    // $(this).select2("destroy");
});

eriktelepovsky avatar Dec 21 '21 16:12 eriktelepovsky

That's odd, haven't touched this code for a while... are you configuring your own version of select2 library in settings.SELECT2_JS? If so, could you check which version you're using?

asfaltboy avatar Jan 24 '22 07:01 asfaltboy