i am new for sencha touch. Please see code at below

view.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',

                    }


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

I need to change fieldset value when I press Reply button. Any example? please give me solution. Thanks

有帮助吗?

解决方案

In your Handler you want to dynamically set the values for you fieldset. So the handler for your button would look something like this:

...
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');
        }
    }
]
...
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top