0

I am trying to pass ember component "this" context to kendo chart seriesClick event, but getting error this.sendAction is not a function.Below is my code

import Ember from 'ember';

export default Ember.Component.extend({

chartConfig: {
            title : "Global Trade Volume",
    categoryAxis: [{
        field: "product",
        labels: {
            color: "black",
            rotation: 325
        }
    }],
    series: [{
        field: "value"
    }],
    chartArea: {
        width: 500,
        height: 250
    },
     seriesClick : function(e){
     alert('Here we can fetch details form WS and will pass the value:' + e.value);
     //this.updateChart();
    // debugger;
     this.sendAction('globalReportChartClickAction', e); // getting error here.

    }.bind(this)
},

// updateChart () {

// }

});

I also find sender message in templete like {{fm-global-report-chart chartData= model.globalData globalReportChartClickAction=globalReportChartClick}}

same error getting for this.update function.

meager
  • 209,754
  • 38
  • 307
  • 315
Kumar
  • 30
  • 4

1 Answers1

0

the problem here is that your "this" refers to the anon function stored in chartConfig.seriesClick. it doesn't refer to chartConfig. A common way around this is to PASS chartConfig as "this" to the function, through an arg, "self". then, within the function, when you refer to "self" you're referring to chartConfig.

dwoz
  • 158
  • 6
  • Thanks for your reply, but can you provide the sample how can I do that as I am new to Ember. – Kumar Dec 04 '15 at 01:42