Ashish Bhavsar
Ashish Bhavsar

Reputation: 236

How to set height of window from TOP position or How to change the position of window when I perform maximize operation

Step 1 : I am having one window in Extjs.
step 2 : The window is open with Some height and width.
Step 3 : I am clicking on maximize button the window is getting maximized But I don't want that the window to cover the whole screen.On Top, I am having One Toolbar.
Step 4 : By maximizing the window that Toolbar is also getting overlap.

So,Is there is way when I am maximizing the window toolbar should remain nonoverlap

Upvotes: 0

Views: 86

Answers (1)

Ankit Chaudhary
Ankit Chaudhary

Reputation: 4089

You can achieve it by positioning it below toolbar using position(x,y) function and then reducing the height of the window by toolbar's height using setHeight() and getHeight() functions after maximizing the window.

 tools: [{
            type: 'maximize',
            handler: function (evt, toolEl, owner, tool) {
       var toolbarHeight = Ext.ComponentQuery.query('toolbar')[1].getHeight(); //getting height of the toolbar
                var window = owner.up('window');
                window.maximize( );
                window.setPosition(0, toolbarHeight);
                window.setHeight(window.getHeight()-toolbarHeight);
            }
        }]

A working Example

Upvotes: 1

Related Questions