Ticket #19047: 0001-Reload-the-FilteredSelectWidget-values-when-using-th.patch

File 0001-Reload-the-FilteredSelectWidget-values-when-using-th.patch, 1.4 KB (added by olofsj@…, 2 years ago)

Patch for #19047

  • django/contrib/admin/static/admin/js/SelectFilter2.js

    From b8a9189225bb188493460d0f85a647b96f6f6954 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Olof=20Sj=C3=B6bergh?= <olofsj@gmail.com>
    Date: Mon, 1 Oct 2012 10:11:44 +0200
    Subject: [PATCH] Reload the FilteredSelectWidget values when using the
     browser back button.
    
    ---
     .../contrib/admin/static/admin/js/SelectFilter2.js |    8 ++++++++
     1 files changed, 8 insertions(+), 0 deletions(-)
    
    diff --git a/django/contrib/admin/static/admin/js/SelectFilter2.js b/django/contrib/admin/static/admin/js/SelectFilter2.js
    index 24d88f7..1c7034a 100644
    a b window.SelectFilter = { 
    8282
    8383        from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
    8484
     85        // When using the back button all options in the from_box get selected
     86        // = false, so reset it according to the attributes
     87        for (var i = 0; (option = from_box.options[i]); i++) {
     88          if ('selected' in option.attributes && option.attributes['selected'].value == "selected") {
     89            option.selected = true;
     90          }
     91        }
     92
    8593        // Set up the JavaScript event handlers for the select box filter interface
    8694        addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
    8795        addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
Back to Top