It would be much nicer if the "available" box stayed where it was.
At [https://www.matific.com Matific] where we encountered this, we
monkeypatched the control's media to add a JavaScript file with this code:
{{{
(function($){
if(!SelectBox)
return;
var oldRedisplay = SelectBox.redisplay;
if(typeof oldRedisplay !== 'function')
return;
SelectBox.redisplay = function(id) {
var top = $('#'+id).scrollTop(); //record current scroll
var res = oldRedisplay.apply(this, arguments);
$('#'+id).scrollTop(top); // Restore the scroll
return res;
};
})(django.jQuery);
}}}
I'm attaching a minimal project to demonstrate it.
--
Ticket URL: <https://code.djangoproject.com/ticket/31522>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "multiselect.tgz" added.
This project has a user "shai" with password "1" to log in to the admin in
the included database
* ui_ux: 0 => 1
* component: Uncategorized => contrib.admin
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:1>
* type: Uncategorized => Bug
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:2>
* owner: nobody => TapanGujjar
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:3>
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:4>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/12833
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:5>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:6>
* cc: TapanGujjar (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:7>
* needs_better_patch: 1 => 0
Comment:
https://github.com/django/django/pull/12833
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:8>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"2d67222472f80f251607ae1b720527afceba06ad" 2d672224]:
{{{
#!CommitTicketReference repository=""
revision="2d67222472f80f251607ae1b720527afceba06ad"
Fixed #31522 -- Made admin's SelectBox preserve scroll position.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31522#comment:10>