最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Get parent component in ExtJS - Stack Overflow

programmeradmin2浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 3

Using .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');

发布评论

评论列表(0)

  1. 暂无评论