clint
clint

Reputation: 14524

ExtJS: show/hide events don't cascade down?

Is there a known limitation (or bug?) in ExtJS 3.2.x where events like show/hide fail to always be cascaded down a hierarchy of panels?

I have a panel that is nested inside a hierarchy of other panels. This panel's "show" event only fires the very first time it's shown. The "show" event in the "root" panel fires every time, however.

This forum post seems to indicate that events are not cascaded in 3.x. Can someone confirm or offer more info?

Thanks!

Upvotes: 0

Views: 2897

Answers (2)

NT3RP
NT3RP

Reputation: 15370

You may be able to cascade using the cascade method, if the component you are working with supports it (Ext.layout.Panels do). For example, if you had a panel, contained within a panel, and you wanted to hiden the child panel when the parent was hidden, you could try this:

validXTypes = ['panel'] //include any other valid types

parentPanel.cascade(function () {
    //if this component can be hidden...
    if (validXTypes.indexOf(this.xtype) != -1) {
        //...then hide it!
        this.hide();
    }
});

Upvotes: 1

ChrisR
ChrisR

Reputation: 14467

Show/hide events are indeed not cascaded. The reason is that show/hide is actually just a dom manipulation and has nothing to do with the component hierarchy.

If a component contains sub components they are dom descendants of the containing component and thus also hidden if the containing components dom node is hidden. But this is just a side effect of the dom hierarchy of the components, not of the component hierarchy.

Upvotes: 1

Related Questions