本文介绍了多个Ember.Select绑定到单个控制器,选择在Firefox中不首先同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个例子中:我有两个 Ember.Select 与选择绑定到单个控制器。使用Firefox(我正在运行版本15.0 Mac),当我改变第一个的值时,选择,第二个选择不会改变。如果我继续改变第二个的值,选择以匹配第一个,那么对选择的所有后续更改将会被传播到另一个。使用Chrome / Safari,选择从头开始保持同步。

火狐?我期望 select s保持同步吗?

解决方案

这可能不是一个Ember的错误,但与Firefox的问题我猜。

如果您在Firefox中检查与DOM检查器(Firebug),您可以看到正确选项正在被选中,两个选择菜单正在同步更改。它只是它没有被显示,直到我们改变了几次显示。

所以 Ember 无论如何成功在正确的选项中设置 selected =selected时,Firefox在使用ui时显示正确的项目时出现问题。 / p>

我为此问题创建了另一张票:



学分:


In this example: http://jsfiddle.net/5WrcD/2/ I have two Ember.Selects with selection bound to a single controller. Using Firefox (I'm running version 15.0 Mac), when I change the value of the first select, the second select does not change. If I then proceed to change the value of the second select to match the first, all subsequent changes to either select will be propagated to the other. Using Chrome/Safari the selects stay synchronized from the beginning.

Could this possible be a bug in Ember or Firefox? Am I wrong to expect the selects to stay synchronized?

解决方案

This is probably not a bug with Ember, but an issue with Firefox I guess.

If you check with a DOM inspector(Firebug) in Firefox you can see that the correct options are getting selected, the two select menus are changing synchronously. Its just that its not being shown in display until we change a couple of times.

So Ember is anyway successful in setting selected="selected" on the correct option , Firefox is having problems showing the correct item in ui.

I created another ticket here for the issue:

HTML select, correct option selected in DOM, but wrong item shown in firefox

Update

After discussions on the other Question, it is found that setting content:'' will fix the issue in firefox. So if you dont want any default selection you are good to go without this.

Eg : http://jsfiddle.net/5WrcD/3/show/

Credits : vol7ron

这篇关于多个Ember.Select绑定到单个控制器,选择在Firefox中不首先同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:20