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 = {
|
82 | 82 | |
83 | 83 | from_box.setAttribute('name', from_box.getAttribute('name') + '_old'); |
84 | 84 | |
| 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 | |
85 | 93 | // Set up the JavaScript event handlers for the select box filter interface |
86 | 94 | addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); }); |
87 | 95 | addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); }); |