javascriptember.jsember-dataember-cliember-cli-addons

#ember-power-select: changing the value in one power-select box , it alternately changes the same value for another power-select box


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.


Solution

  • 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.