Upperstage
Upperstage

Reputation: 3757

Ext.Container does not include a public click event

Why doesn't Ext.Container provide a click event? I thought I could simply add a listener to the config passed to the constructor, but click is not a public event for Ext.Container. I understand I can add a click listener to the DIV created by the container, but why does Container not support this?

Upvotes: 1

Views: 3902

Answers (2)

Brian Moeskau
Brian Moeskau

Reputation: 20419

Ext does not provide every possible DOM event on every component. Sometimes DOM events are propagated through a component when it makes sense (like the various click events you can handle for a grid, for example) but usually component events are custom events that are specific to the functionality of the component. The cases where click events are raised through Ext, it is normally integral to the functionality of the component. Container, as a non-visual base class, would not normally be the level of abstraction at which one would expect to handle clicks. But if you must do so, you'll have to go through the underlying DOM node.

Upvotes: 3

Jerry
Jerry

Reputation: 563

Container is an element, so you should (not tested) be able to do an Ext.get(containerVar).addListener('click', function(evtObj, element) { /* do something */});

Upvotes: 2

Related Questions