ExtJS: automatic resizing of form fields when resizing a window

I created Ext.Window with some Ext.form fields inside. But when I resize the window shape elements still have the initial width and height.

Is explicit form field resizing required when resizing a window? Or is there an option that allows you to automatically resize form fields?

Code example:

var f_1 = new Ext.form.TextField({fieldLabel: 'Label 1'});
var f_2 = new Ext.form.TextField({fieldLabel: 'Label 2'});
var fp = new Ext.form.FormPanel({items: [f_1, f_2]});

var w = new Ext.Window({
    layout: 'form',
    title: 'test',
    items: fp
});

w.show()
+5
source share
3 answers

You can check the binding that makes for beautifully modifiable forms:

http://www.extjs.com/deploy/dev/examples/form/anchoring.html

See the anchor property on Component:

http://www.extjs.com/deploy/dev/docs/?class=Ext.Component

+4
var f_1 = new Ext.form.TextField({fieldLabel: 'Label 1', anchor:'95%'});

. .

, , defaults

var fp = new Ext.form.FormPanel({
           items: [f_1, f_2]
           ,defaults: {
               anchor: '95%' 
           }
        });
+1

, FormPanel "fp" .

Ext JS Ext.Window. .

(, : 100%, , . - .., ... , .)

0

All Articles