I'm using ExtJS 5.1. I have a panel with a definition of button in the items-section with a listerner for event 'click'. The 'this'-keyword refers here to the button itself. But I want a new ponent to my panel, so I need reference to this panel in the listener-function. 'this.getParent().add(...)' doesn't function, no function error, this.container.getParent().add(...) results in the same error. What is the correct way?
I'm using ExtJS 5.1. I have a panel with a definition of button in the items-section with a listerner for event 'click'. The 'this'-keyword refers here to the button itself. But I want a new ponent to my panel, so I need reference to this panel in the listener-function. 'this.getParent().add(...)' doesn't function, no function error, this.container.getParent().add(...) results in the same error. What is the correct way?
Share Improve this question asked Apr 26, 2016 at 11:27 Rafal ZiolkowskiRafal Ziolkowski 131 gold badge2 silver badges7 bronze badges 1- You need to post the code. – Evan Trimboli Commented Apr 26, 2016 at 12:05
1 Answer
Reset to default 3Using .up('panel')
in the first argument of the click function, which is the button itself.
Or in ExtJS 5 define a reference
property in your panel, and use
this.lookupReference('your_reference_in_panel');