» Fig Leaf Software Home

We've Got You Covered.

Wednesday, May 7, 2014

Protip: Constraining Ext JS Windows

This is the only methodology that I’ve found which reliably constrains windows to panels.
Step 1: Define your window with a constrain: true property
1
2
3
4
5
6
7
8
9
10
11
12
Ext.define('MyApp.view.MyWindow', {
    extend: 'Ext.window.Window',
    alias: 'widget.mywindow',
    autoShow: true,
    height: 320,
    width: 501,
    constrain: true,
    layout: {
        type: 'fit'
    },
    title: 'My Constrained Window'
});
Step 2: Instantiate the window into a container using the constrainTo property.
1
2
3
4
5
6
7
8
9
10
// get reference to parent panel / container
var parentPanel = Ext.ComponentQuery.query('#dashboardPanel')[0];
 
// instantiate and constrain the window
 
Ext.widget('mywindow', {
   constrainTo: parentPanel.getEl(),
   x: 5,
   y: 20
});

[Written by: Steve Drucker]
[Cross-promoted: Druck-I.T.]

No comments:

Post a Comment

About Us

Fig Leaf Software is an award-winning team of imaginative designers, innovative developers, experienced instructors, and insightful strategists.

For over 20 years, we’ve helped a diverse range of clients...

Read More

Contact Us

202-797-7711

Fig Leaf Software

1400 16th Street NW
Suite 450
Washington, DC 20036

info@figleaf.com