简体   繁体   English

KnockoutJS selectedOptions绑定导致选择框在IE8中抖动

[英]KnockoutJS selectedOptions binding causes select box to jitter in IE8

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). 这仅在IE8中,当我将多个值选择框绑定到带有selectedOptions的observableArray时发生,并且项目多于select可以显示(启用滚动)。 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. 因此,每当我按住Ctrl键并单击选择框中的项目时,滚动位置就会“跳开”,最终我会被向下滚动一点。 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. 据我了解,该问题是由于selectedOptions的双向绑定所致:当我单击一个项目时,它被添加到数组中,这继而在observableArray通知UI更改后导致选择框重新填充。 Is there anything that can be done? 有什么可以做的吗?

UPDATE: 更新:

I ended up using this binding: 我最终使用了此绑定:

<select data-bind='visible:operator() ? operator().Element == "DropDown" : false, 
                                options: property() ? property().ReferenceItems : null, 
                                optionsText: "Name", 
                                optionsValue: "Id", 
                                optionsCaption: "Выберите...", 
                                selectedOptions: selectedValues,
                                multiple: selectedValues().length > 1'>
</select>

I don't know... all I can recommend is try asking this on the knockoutjs google group. 我不知道...我唯一能推荐的就是尝试在Google的ockoutoutjs小组上问这个问题。 It seems to be active and has folks who are experts responding to stuff like this. 它似乎很活跃,并且有专家来回应这样的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM