#13614: Back button breaks many to many widget
-------------------------------+------------------------------------
Reporter: minarets | Owner: julien
Type: Bug | Status: new
Component: contrib.admin | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------+------------------------------------
Comment (by KyleMac):
I got fed up with how slow and crash happy `SelectBox` was with large
(1000-11000) lists and rewrote a large chunk and submitted a pull request
at Github in reference to #3202. I wish I had seen this ticket and knew
that you guys were willing to accept a total jQuery based rewrite because
I would have done that.
The code on this page performs no faster than the original. There is no
need for a refresh_state on every action and ''all'' manipulation should
be done outside of the DOM. Stuff like `.find('option:selected')` is also
very slow.
When I saw this ticket I realised that my code has an even worse version
of this bug (it's still there in Chrome 20). Mine would actually select
the top N options to fill the right column which I think is worse than no
options at all. One of the Chromium tickets says that the problem is that
Webkit remembers selections by selectedIndex rather than the value
attribute which lead me to the solution.
After pressing the back button if you inspect the DOM you will notice that
while `option.selected` is wrong the selected attribute is still actually
in the HTML and correct. So what I did was call a fake `replaceState` so
that a `popstate` is fired on page back and then just redisplay the
selections based on the selected attribute from `getAttribute`. Now
there's no need to waste twice the resources on a copy of the list.
https://github.com/django/django/pull/222
--
Ticket URL: <https://code.djangoproject.com/ticket/13614#comment:31>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.