PDA

View Full Version : Object [object Object] has no method



novosmt
6 Apr 2012, 5:18 PM
Hi,

I am calling the "handleBackNextBtn" function from the listener code (see below)... I am getting an "Object [object Object] has no method 'handleBackNextBtn" error in the handleBackNextBtn function. Thoughts ?


launch: function() {
topic1Carousel = Ext.create("POS.view.Topic1", {
listeners: {
activeitemchange: function(view, record) {
this.handleBackNextBtn(topic1Carousel);
}
}
});

}

handleBackNextBtn: function(obj) {
console.log(obj);
}


Steve

kostysh
7 Apr 2012, 2:34 PM
'this' inside your listener and 'this' related to your main object is not the same object.
Try to define a link to 'this' of your main object and use it inside listener.

launch: function() {
var me = this;
topic1Carousel = Ext.create("POS.view.Topic1", {
listeners: {
activeitemchange: function(view, record) {
me.handleBackNextBtn(topic1Carousel);
}
}
}

novosmt
7 Apr 2012, 4:40 PM
kostysh,

Your solution worked perfectly, Thank You