I’m trying to get the record ID from the underlying object set on the view object, so I can set it on the view’s HTML wrapper. Here’s what I’m trying:
// Row in record editing table view.
views.RecordActionTableRowView = Ember.View.extend({
// Does not work.
attributeBindings: ['record_id:data-record-id'],
templateName: 'pult-record-action-table-row',
init: function () {
console.log(this);
// Does not work either. Undefined.
console.log(this.get('record_id'));
// Does not work either. Undefined.
console.log(this.record);
return this._super();
}
});
This view is called from a template, so its own template contains the right data, but I can’t find it inside the view code. Any suggestions?
You probably want
this.get('context')orthis.get('content'). In some circumstances, checking this withindidInsertElementmay be better than ininit, in case the view is created beforecontextis set.