Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extjs panel resize while window resizes

I have a panel with a "form" layout, containing several buttons. now I want to enable this panel resize according to window resizing. How can I get this done?

thanks.

like image 869
Simon Avatar asked May 04 '11 15:05

Simon


2 Answers

Ext.EventManager.onWindowResize(function(w, h){
    panel.doComponentLayout();
});

Assuming you have a Panel named 'panel' with some automatic sizing built in (e.g. height: "100%"). Otherwise, the new width and height of the window are passed into the anonymous function passed to onWindowResize().

like image 180
dinesy Avatar answered Nov 14 '22 19:11

dinesy


As wrote @deniztt you should subscribe to EventManager class onWindows Resize Event.

It can be something like this:

Ext.EventManager.onWindowResize(function () {

    var width = Ext.getBody().getViewSize().width - 160;
    var height = Ext.getBody().getViewSize().height - 140;

    panel.setSize(width, height);

});

Where panel is reference to your panel

You can read about it here.

like image 5
Gregory Nozik Avatar answered Nov 14 '22 18:11

Gregory Nozik