Last active
August 29, 2015 14:24
-
-
Save thoov/b626f9e761aed195cd56 to your computer and use it in GitHub Desktop.
Ember Table built with compossible components. https://github.com/emberjs/ember.js/issues/11124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ember.Controller.extend({ | |
arrayOfData: [{ | |
firstName: 'Bob', | |
lastName: 'Smith' | |
},{ | |
firstName: 'Jane', | |
lastName: 'Doe' | |
},{ | |
firstName: 'Bill', | |
lastName: 'Todd' | |
}] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ember.Component.extend({ | |
init: function() { | |
this._super.apply(this, arguments); | |
var table = this.attrs.table.value; | |
var blockTemplate = this.get('_blockTemplate'); // This does not exist yet | |
table.registerColumns.call(table, {template: blockTemplate, attrs: this.attrs}); | |
}, | |
// Do not render the block template | |
render: function() {} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ember.Component.extend({ | |
columns: null, | |
headers: null, | |
init() { | |
this._super.apply(this, arguments); | |
this.setProperties({ | |
columns: Ember.A(), | |
headers: Ember.A() | |
}) | |
}, | |
registerColumns: function(columnObject) { | |
this.get('columns').pushObject(columnObject); | |
this.get('headers').pushObject(columnObject.attrs.header); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment