selectedOptions bound to observableArray scrolls select list after selection

73 peržiūros
Praleisti ir pereiti prie pirmo neskaityto pranešimo

Valentin

neskaityta,
2010-11-18 07:57:572010-11-18
kam: KnockoutJS
This is only in IE8,
Occurs when I have a multiple values select box bound to
observableArray with selectedOptions and there are more items than
select can show (scrolling is enabled).
So whenever I Ctrl+click the item in a select box the scrolling
position 'jumps away' and I end up being scrolled down a bit. This
produces a jittery unpleasant experience.
As I understand it, this problems is because of two-way binding of
selectedOptions: when I click on an item, it gets added to the array,
which in turn causes the select box refill after observableArray
notifies the UI of its changes.
Is there anything that can be done?

Steven Sanderson

neskaityta,
2010-11-18 10:34:592010-11-18
kam: knock...@googlegroups.com
Thanks for reporting this. We'll need to enhance the selectedOptions binding so that, where possible, it restores the scroll position after each change. 

If you feel able to implement this yourself please go ahead and then send me a pull request. Otherwise, I'll get to it when I have chance.

Regards
Steve

thelinuxlich

neskaityta,
2010-12-03 05:33:482010-12-03
kam: KnockoutJS
Fixed on my branch: https://github.com/thelinuxlich/knockout

On 18 nov, 13:34, Steven Sanderson <ste...@stevensanderson.com> wrote:
> Thanks for reporting this. We'll need to enhance the selectedOptions binding
> so that, where possible, it restores the scroll position after each change.
>
> If you feel able to implement this yourself please go ahead and then send me
> a pull request. Otherwise, I'll get to it when I have chance.
>
> Regards
> Steve
>

Ameet Kaustav

neskaityta,
2015-08-27 14:15:202015-08-27
kam: KnockoutJS
I am able to see this still occurring on Internet Explorer 11.
On Mozilla Firefox it doesn't scroll to the last selected option.
Here is a fiddle: http://jsfiddle.net/4rdSf/

Ameet
Atsakyti visiems
Atsakyti autoriui
Persiųsti
0 naujų pranešimų