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') or this.get('content'). In some circumstances, checking this within didInsertElement may be better than in init, in case the view is created before context is set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With