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

Select returning previous selection

未關閉
#187 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
198
分支
77
PR 合併指標
30 天內沒有已合併 PR

描述

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

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。