vendredi 24 mars 2017

Computed property don't observe changes in objects in array

My component don't observe changes in my array of objects, when i change language. It works only after change route, but it's deserved to change everything immediately, without reload page.

Component code:

  columnsToEdit: Ember.computed('i18n.locale', function() {
    let i18n = this.get('i18n');
    return Ember.A([
      {
        "propertyName": "name",
        "title": i18n.t('Name')
      },
      {
        "propertyName": "phone",
        "title": i18n.t('Name'),        
      },
    ]);
  }),

  columns: Ember.computed.map('columnsToEdit.[]', function(column){
    return column;
  }),

I think, it should works. "ColumnsToEdit" looks for changes from i18n.locale in "columsToEdit". Next "columns" looks for changes in "columnsToEdit". When I call "console.log" in "columns" it returns expected result, but in my view nothing happened after click "language-switch". So why my component didn't change "titles" in view? Any help will be appreciated.




Aucun commentaire:

Enregistrer un commentaire