Javascript-форум (https://javascript.ru/forum/)
-   ExtJS (https://javascript.ru/forum/extjs/)
-   -   Как изменить параметры у fieldset? (https://javascript.ru/forum/extjs/7391-kak-izmenit-parametry-u-fieldset.html)

exvion 29.01.2010 22:11

Как изменить параметры у fieldset?
 
Вот часть кода из официальных примеров
http://www.extjs.com/deploy/dev/exam...m/dynamic.html

Ext.onReady(function(){
	var bd = Ext.getBody();

    bd.createChild({tag: 'h2', html: 'Form 2 - Adding fieldsets'});

    var fsf = new Ext.FormPanel({
        labelWidth: 75, // label settings here cascade unless overridden
        url:'save-form.php',
        frame:true,
        title: 'Simple Form with FieldSets',
        bodyStyle:'padding:5px 5px 0',
        width: 350,

        items: [{
            xtype:'fieldset',
            checkboxToggle:true,
            title: 'User Information',
	    id: 'userinformation',
            autoHeight:true,
            defaults: {width: 210},
            defaultType: 'textfield',
            collapsed: true,
            items :[{
                    fieldLabel: 'First Name',
                    name: 'first',
                    allowBlank:false
                },{
                    fieldLabel: 'Last Name',
                    name: 'last'
                },{
                    fieldLabel: 'Company',
                    name: 'company'
                }, {
                    fieldLabel: 'Email',
                    name: 'email',
                    vtype:'email'
                }
            ]
        },{
            xtype:'fieldset',
            title: 'Phone Number',
            collapsible: true,
            autoHeight:true,
            defaults: {width: 210},
            defaultType: 'textfield',
            items :[{
                    fieldLabel: 'Home',
                    name: 'home',
                    value: '(888) 555-1212'
                },{
                    fieldLabel: 'Business',
                    name: 'business'
                },{
                    fieldLabel: 'Mobile',
                    name: 'mobile'
                },{
                    fieldLabel: 'Fax',
                    name: 'fax'
                }
            ]
        }],

        buttons: [{
            text: 'Save'
        },{
            text: 'Cancel'
        }]
    });


    fsf.render(document.body);
});


Стоит задача раскрыть блок "user information" и поменять title.
Следующий код, запущенный в консоли firebug не работает.
Ext.get('userinformation').set({collapsed: false});
Ext.get('userinformation').set({title:"new title"});

В чем загвоздка?

Kolyaj 29.01.2010 22:36

А почему это должно работать?

Ext.getCmp('userinformation').expand();
Ext.getCmp('userinformation').setTitle('new title');

exvion 29.01.2010 22:43

Спасибо.


Часовой пояс GMT +3, время: 16:51.