0

Ember では、ビューのmultipleプロパティを使用して複数選択を作成できます (この投稿など)。Ember.Select

私がやりたいのは、複数選択を複数の「通常の」選択に置き換えることです。これらはすべて同じ配列にバインドされています。2 つの単一選択があるとします。両方を array にバインドする必要がありますfooArray。最初の選択でfooを選択し、2 番目の選択でbarfooArrayを選択すると、 になります['foo', 'bar']

それを行う方法についてのアイデアはありますか?

よろしく、マリウス

4

1 に答える 1

0

選択ごとにselectionBindingを設定でき、計算されたプロパティtahaが配列を作成します...これを行うためのより良い方法があることを確認してください...これは、処理する選択の数に依存します。この例では、返された配列取得するたびに再計算され、これはあまりうまくスケーリングしません

App.SelectionController = Ember.ObjectController.extend({
    select1Value:null,
    select2Value:null,
    select3Value:null,
    selectedArray:function{
        return Ember.Array(this.get('select1Value'),this.get('select2Value'),this.get('select2Value'));
    }.property('select1Value','select2Value','select3Value')

});

ビューで

{{view Ember.Select
    contentBinding="YourSelectContent"
    selectionBinding="App.SelectionController.select1Value"
[...]
{{view Ember.Select
    contentBinding="YourSelectContent"
    selectionBinding="App.SelectionController.select2Value"
[...]
{{view Ember.Select
    contentBinding="YourSelectContent"
    selectionBinding="App.SelectionController.select3Value"
[...]
于 2013-10-15T09:48:56.440 に答える