Skip to content

Commit

Permalink
Add better component example
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorzas committed Sep 8, 2016
1 parent 502abe5 commit 90f1507
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const computed = Ember.computed;

export default Ember.Component.extend({
model: null,
table: null,
_table: null,

columns: computed(function() {
return [{
Expand Down Expand Up @@ -90,10 +90,19 @@ export default Ember.Component.extend({
}];
}),

table: computed('model.[]', function() {
/*
Set the table rows when our model changes
*/
this.get('_table').setRows(this.get('model'));

return this.get('_table');
}),

init() {
this._super(...arguments);
this.set('table', new Table(this.get('columns'), this.get('model')));
}
this.set('_table', new Table(this.get('columns')));
},
});
```

Expand Down

0 comments on commit 90f1507

Please sign in to comment.