adopted-ember-addons / adopted-ember-addons/emberx-select

Select returning previous selection

Offen
#187 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
198
Forks
77
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Version of x-select:
3.0.0
### Ember Version / Ember CLI Version:

**Ember Version: 2.12**
**Ember CLI Version: 2.12**

### Expected Behavior
Should return value of current selection

route template:

{{#x-select on-click=(action "selectSite") value=locations.id as |xs|}}
Site Filter
{{#each locations as |location|}}
{{#xs.option value=location.id}}{{location.name}}{{/xs.option}}
{{/each}}
{{/x-select}}

controller:

export default Ember.Controller.extend({
start: Ember.inject.service(),
locations: Ember.computed.oneWay('start.sites'),
actions: {
selectSite(value, component) {
alert('site selected:' + value);
}
}
}

Example options:

ID Text
--- -----
null Site Filter
1 Albany
2 Chicago
3 Cleveland
4 Topeka

### Actual Behavior

Value being passed to action is the value from the previous selection. For example, if Site Filter is shown as selected and then Chicago is selected, the id returned would be null. Then selecting Topeka would return id 2 because Chicago was the last selection. The next selection would return id of 4.

Selected location option is shown correctly in the selector but value returned is always from the previous selection. I would expect that when I transitioned to the route that I'd also trigger the alert for the 'Site Filter' option being the default selection.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.