Search code examples
javascriptselectember.jsember-datajsbin

Options not displayed in Ember view Select editable


I can display all my options value and labels when the view is not in the editable mode, the problem is that i can not achieve the same when the Ember Select View is in the editable mode.

Here the code in matter:

App.ThreadsController=Ember.ArrayController.extend({

   selectContentTariffa: null,

   selectContentTariffa: [
     {label: "180", value: "180"},
     {label: "200", value: "200"},
     {label: "300", value: "300"}
   ],

in my view in Editable mode where i can not display the options

{{#if editable}}
<td>{{view Ember.Select prompt="Tariffa" content=selectContentTariffa optionValuePath="content.value" optionLabelPath="content.label" selectionBinding="selectContentTariffa" valueBinding="content.label"}}</td>

in my view when it's not editable and the options are displayed correctly

<td>{{view Ember.Select prompt="Tariffa" content=selectContentTariffa optionValuePath="content.value" optionLabelPath="content.label"}}</td>

Here a jsbin in action to reproduce the issue: http://jsbin.com/begopu/19/edit


Solution

  • Your scope has changed inside of your each, so the controller is no longer this meaning you don't have access to it's properties. You can alleviate this by using each item in model allowing controller/this to still be in scope and the item you are iterating to be scoped as item

    Example: http://jsbin.com/jumem/1/edit