#ember-power-select:更改一个电源选择框中的值,它交替更改另一个电源选择框中的相同值 [英] #ember-power-select: changing the value in one power-select box , it alternately changes the same value for another power-select box

查看:21
本文介绍了#ember-power-select:更改一个电源选择框中的值,它交替更改另一个电源选择框中的相同值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 #ember-power-select 中使用了自定义搜索操作,更改了一个电源选择框中的值,它交替更改另一个电源选择的值(设置与第一个选择框中选择的值相同的值)盒子也是.

I used custom-search-action in #ember-power-select, changing the value in one power-select box , it alternately changes the value(sets the same value as selected in 1st select box)for another power-select box too.

以下是车把代码:

{{#each model.hpqualifications as |hpqualification|}}
{{#power-select
  selected=hpqualification.hoprofile
  search=(action "hoProfile")
  onchange=(action (mut hpqualification.hoprofile.name) value="name")
  as |repo|
}}
  {{repo.name}}
{{/power-select}}
{{/each}}

上面的代码生成了两个选择框,因为#each方法有两个数据.

The above code generated two select box since #each method has two data.

一切正常.但是当从第一个选择框的下拉列表中选择值时,第二个选择框也会更改为相同的值.

Everything works fine. But when selecting the value from dropdown for 1st select box, the 2nd select box too changes to the same value.

如何解决这个问题?

请参考我之前的stackoverflow 其他文件和数据格式的问题.

Please refer to my previous stackoverflow question for other files and data format.

推荐答案

你的问题是这个 (action (mut hpqualification.hoprofile.name) value="name")

这实际上会更改当前选定的 hoprofile 对象的名称.这意味着,现在您可能有两个同名的对象.

This will actually change the name of the current selected hoprofile object. Which means, that now you could potentially have two objects with a same name.

如果你把它改回(action (mut hpqualification.hoprofile)),那实际上会改变被选中的对象.

If you change it back to (action (mut hpqualification.hoprofile)), that will actually change the object that is selected.

现在我不知道你想要得到什么最终结果,但我认为这是你的问题.

Now I don't know what the end result you are trying to get, but I think this is you problem.

这篇关于#ember-power-select:更改一个电源选择框中的值,它交替更改另一个电源选择框中的相同值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆