Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Computed property on model attributes

$
0
0

@ImmortalDragon wrote:

Good day.
I'm writing component, which depend on model's attributes. (table row, each column - different attribute of a model)
I don't know these attributes before runtime.
So i want to use computed property, but how?

columns: [{
    columnHeader: 'Наименование',
    name: 'name'
  }, {
    columnHeader: 'Артикул',
    name: 'model'
  }],

cells: Ember.computed('row.?????????'), function() {
    return this.get('columns').map((column) => {
      return Ember.Object.create({
        data: this.get(`row.${column.name}`),
        isEditing: false
      });
    });
  }),

row.@each - not work,
row.{name,model} - work, but it's not reusable (in other model, other attributes)
i need something like row.${someFunction()}, but it's not work too.

row is a model record

Help, please

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles