Andrey Selitsky
Andrey Selitsky

Reputation: 2604

How to force ExtJs panel keep width when it is hidden

I'm having the following issue with extjs panel.

I have a parent panel with hbox layout, and among its children I have another panel with hbox layout. Initially the child panel is hidden, I'm showing it only on some conditions.

The problem is that the width of the hidden child = 0, so it doesn't keep width it has when it is visible. But I need it to have the same width even when it's hidden.

Any thoughts?

Upvotes: 2

Views: 2575

Answers (1)

jthurau
jthurau

Reputation: 447

Instead of calling hide() on the child panel, try this:

childPanel.getEl().setOpacity(0); //0 to hide, 1 to show

That way the panel is always there, you just control the visibility. It won't mess up your layouts upon hide/show.

Upvotes: 6

Related Questions