I'm implementing a basic Ember Component which will render a Morris.js line graph. I need to listen to the click event on morris and pass it to the action.
App.ProgressGraphComponent = Ember.Component.extend(
{
graph: null,
tagName: 'div',
renderGraph: function()
{
this.graph.setData(this.get('progress'));
}.observes('progress'),
didInsertElement: function()
{
var element = this.get('element').id;
var self = this;
this.graph = new Morris.Line(
{
element: element,
xkey: 'date',
ykeys: ['amount', 'increase'],
labels: ['Amount', 'increase'],
resize: true,
smooth: false,
parseTime:false
}).on('click', function(i, row){
self.set('clicked', row);
self.sendAction('goToSession');
});
}
});
In my controller, when the goToSession
event is triggered, it passes in the component
object. I'd prefer it if it just passed in the row
object.
Is this the correct way to bubble the action
up with the row
parameter?