#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
问题描述
以下是句柄代码:
{{ #each model.hpqualifications as | hpqualification |}}
{{#power-select
selected = hpqualification.hoprofile
search =(actionhoProfile)
onchange =(action (mut hpqualification.hoprofile.name)value =name)
as | repo |
}}
{{repo.name}}
{{/ power-select}}
{{/ each}}
上述代码生成两个选择框,因为#each方法有两个数据。
精细。但是,当从第一个选择框的下拉列表中选择值时,第二个选择框也将更改为相同的值。
如何解决这个问题?
请参阅我之前的 stackoverflow 其他文件和数据格式的问题。
您的问题是这个(action(mut hpqualification.hoprofile.name)value =name )
这将实际更改当前选定的hoprofile对象的名称。这意味着,现在你可能有两个同名的对象。
如果将其更改回(action(mut hpqualification.hoprofile))
,那实际上会更改对象这是被选中的。
现在我不知道你想要得到的最终结果,但我认为这是你的问题。
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.
Below is the handlebar code:
{{#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}}
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.
How to fix this ?
Please refer to my previous stackoverflow question for other files and data format.
You issue is this (action (mut hpqualification.hoprofile.name) value="name")
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.
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屋!