0

我是煎茶触摸的新手。请参阅下面的代码

视图.js

        Ext.define("blackbutton.view.Setup.UserProfile", {
        requires: [
            'Ext.form.*',
            'Ext.form.Panel',
            'Ext.form.FieldSet',
            'Ext.field.Number',
            'Ext.field.Spinner',
            'Ext.field.Password',
            'Ext.field.Email',
            'Ext.field.Url',
            'Ext.field.DatePicker',
            'Ext.field.Select',
            'Ext.field.Hidden',
            'Ext.field.Radio',
            'Ext.field.Slider',
            'Ext.field.Toggle'
        ],

        extend: 'Ext.form.Panel',
        xtype: 'SetupUserProfile',
        id: 'SetupUserProfile',
        config: {
            //floating: true,
            //centered: true,
            cls: 'bb-popupForm',
            modal: true,
            width: "100%",
            layout: 'fit',
            height: "100%",
            styleHtmlContent: true,
            //title: 'Black Button',
            //iconCls: 'black',

            scrollable: true,

            items: [{
                docked: 'top',
                xtype: 'titlebar',
                title: 'Profile',

                items: [{
                    xtype: 'button',
                    iconMask: true,
                    iconCls: 'reply',
                    //text: 'Back',
                    handler: function () {

                        //Code here??



                    }
                }]
            },
            {
                xtype: 'panel',
                layout: 'vbox',
                scrollable: true,
                items: [{
                    xtype: 'fieldset',
                    id:'SetupUserProfileFS',
                    title: 'Personal Info',
                    instructions: 'Please enter the information above',
                    defaults: {
                        labelWidth: '35%',
                        required: true
                    },
                    items: [
                    {
                        xtype: 'textfield',
                        id: 'BB_ID',
                        name: 'BB_ID',
                        label: 'BB ID',


                    },
                    {
                        xtype: 'emailfield',
                        id: 'email',
                        name: 'email',
                        label: 'Email',
                        placeHolder: 'me@email.com',

                    }, {
                        xtype: 'textfield',
                        id: 'fullName',
                        name: 'fullName',
                        label: 'Full Name',
                        placeHolder: 'John',

                    }, {
                        xtype: 'numberfield',
                        id: 'mobilePhone',
                        name: 'mobilePhone',
                        label: 'Mobile Phone',
                        placeHolder: '012567890',

                    },
                     {
                        xtype: 'textfield',
                        id: 'DOB',
                        name: 'DOB',
                        label: 'Date of birth',
                        placeHolder: '30/03/1988',

                    },

                    {
                        xtype: 'textfield',
                        id: 'mailingAddress',
                        name: 'mailingAddress',
                        label: 'Mailing Address',
                        placeHolder: 'No 11, Jalan taman desa, 54100 KL',

                    }


                     ]
                }, 
                    }]
                }]
            }]
        }
    }); 

当我按下回复按钮时,我需要更改字段集值。有什么例子吗?请给我解决方案。谢谢

4

1 回答 1

1

在您的处理程序中,您希望为您的字段集动态设置值。所以你的按钮的处理程序看起来像这样:

...
items: [
    {
        xtype: 'button',
        iconMask: true,
        iconCls: 'reply',
        handler: function () {
            Ext.getCmp('BB_ID').setValue('New value for BB_ID field');
            Ext.getCmp('email').setValue('New value for email field');
            Ext.getCmp('fullName').setValue('New value for fullName field');
            Ext.getCmp('mobilePhone').setValue('New value for mobilePhone field');
            Ext.getCmp('DOB').setValue('New value for DOB field');
            Ext.getCmp('mailingAddress').setValue('New value for mailingAddress field');
        }
    }
]
...
于 2013-05-13T03:06:38.160 回答