Forms extjs将参数传递到表单

Forms extjs将参数传递到表单,forms,extjs,Forms,Extjs,我有一个两列的gridpanel,第一列显示用户名,第二列是带有编辑按钮的actioncolumn,当单击编辑按钮时,通过显示带有表单的窗口并输入新密码来更改用户密码 如何将“用户名”传递到表单并显示。 我正在试着使用商店。 还有别的办法吗 我的代码 gridpanelview.js actioncolumn: /*...config*/ { xtype: 'actioncolumn', items: [ { handler:function(v

我有一个两列的gridpanel,第一列显示用户名,第二列是带有编辑按钮的actioncolumn,当单击编辑按钮时,通过显示带有表单的窗口并输入新密码来更改用户密码

如何将“用户名”传递到表单并显示。 我正在试着使用商店。 还有别的办法吗

我的代码

gridpanelview.js
actioncolumn:
/*...config*/
{
    xtype: 'actioncolumn',
    items: [
        {
         handler:function(view, rowIndex, colIndex, item, e, record, row) {
                        var pwdwin = Ext.create('myapp.view.SetPwdWin');
                        var store = Ext.create(myapp.store.mystore)
                         mysore.setData(record)
                        pwdwin.show();
                    },
                    icon: 'edit.png',
                    tooltip: 'change passpword'
    }]
}



 mywindow.js:
        /*...config*/
        dockedItems: [
            {
                xtype: 'form',
                dock: 'top',
                reference: 'form',
                height: 200,
                id: 'pwd_form',
                bodyPadding: 10,
                header: false,
                title: 'My Form',
                layout: {
                    type: 'vbox',
                    align: 'center'
                },
                items: [
                    {
                        xtype: 'textfield',
                        flex: 1,
                        id: 'user_name',
                        maxHeight: 20,
                        padding: 10,
                        fieldLabel: 'Name',
                        editable: false
                    },
                    {
                        xtype: 'textfield',
                        id: 'new_pwd',
                        padding: 10,
                        fieldLabel: 'Password',
                        inputId: 'new_pwd_value',
                        inputType: 'password',
                        allowBlank: false,
                        maxLength: 20,
                        minLength: 6
                    },
                    {
                        xtype: 'textfield',
                        id: 'confirm_pwd',
                        fieldLabel: 'confirm',
                        inputId: 'confirm_pwd_value',
                        inputType: 'password',
                        allowBlank: false,
                        maxLength: 20,
                        minLength: 6
                    },
                    {
                        xtype: 'button',
                        text: 'OK',
                        listeners: {
                            click: 'set_new_pwd'
                        }
                    }
                ]
            }
        ],
set_form_username: function() {
        //get Store data 
        form = this.getReferences().form.getForm();
       //how to set username to the label
}
     set_new_pwd: function(button, e, eOpts) {
    //send username and new username to server
    }

尝试使用
getDockingRefItems('pwd_form')
getDockedItems()

例如:

Ext.application({
    name: 'Fiddle',

    launch: function() {

        Ext.create('Ext.Button', {
            text: 'Click me',
            renderTo: Ext.getBody(),
            handler: function() {
                // way 1
                w.getDockedItems()[0].items.items[0].setValue('your user name');

                // way2
                w.getDockingRefItems('pwd_form')[1].setValue('your user name');
                w.show();

            }
        });

        var w = Ext.create('Ext.window.Window', {
            title: 'Hello',
            height: 200,
            width: 400,
            dockedItems: [{
                xtype: 'form',
                dock: 'top',
                reference: 'form',
                height: 200,
                id: 'pwd_form',
                bodyPadding: 10,
                header: false,
                title: 'My Form',
                layout: {
                    type: 'vbox',
                    align: 'center'
                },
                items: [{
                    xtype: 'textfield',
                    flex: 1,
                    id: 'user_name',
                    maxHeight: 20,
                    padding: 10,
                    fieldLabel: 'Name',
                    editable: false
                }, {
                    xtype: 'textfield',
                    id: 'new_pwd',
                    padding: 10,
                    fieldLabel: 'Password',
                    inputId: 'new_pwd_value',
                    inputType: 'password',
                    allowBlank: false,
                    maxLength: 20,
                    minLength: 6
                }, {
                    xtype: 'textfield',
                    id: 'confirm_pwd',
                    fieldLabel: 'confirm',
                    inputId: 'confirm_pwd_value',
                    inputType: 'password',
                    allowBlank: false,
                    maxLength: 20,
                    minLength: 6
                }, {
                    xtype: 'button',
                    text: 'OK',
                    listeners: {
                        click: 'set_new_pwd'
                    }
                }]
            }]
        });
    }
});

尝试使用
getDockingRefItems('pwd_form')
getDockedItems()

例如:

Ext.application({
    name: 'Fiddle',

    launch: function() {

        Ext.create('Ext.Button', {
            text: 'Click me',
            renderTo: Ext.getBody(),
            handler: function() {
                // way 1
                w.getDockedItems()[0].items.items[0].setValue('your user name');

                // way2
                w.getDockingRefItems('pwd_form')[1].setValue('your user name');
                w.show();

            }
        });

        var w = Ext.create('Ext.window.Window', {
            title: 'Hello',
            height: 200,
            width: 400,
            dockedItems: [{
                xtype: 'form',
                dock: 'top',
                reference: 'form',
                height: 200,
                id: 'pwd_form',
                bodyPadding: 10,
                header: false,
                title: 'My Form',
                layout: {
                    type: 'vbox',
                    align: 'center'
                },
                items: [{
                    xtype: 'textfield',
                    flex: 1,
                    id: 'user_name',
                    maxHeight: 20,
                    padding: 10,
                    fieldLabel: 'Name',
                    editable: false
                }, {
                    xtype: 'textfield',
                    id: 'new_pwd',
                    padding: 10,
                    fieldLabel: 'Password',
                    inputId: 'new_pwd_value',
                    inputType: 'password',
                    allowBlank: false,
                    maxLength: 20,
                    minLength: 6
                }, {
                    xtype: 'textfield',
                    id: 'confirm_pwd',
                    fieldLabel: 'confirm',
                    inputId: 'confirm_pwd_value',
                    inputType: 'password',
                    allowBlank: false,
                    maxLength: 20,
                    minLength: 6
                }, {
                    xtype: 'button',
                    text: 'OK',
                    listeners: {
                        click: 'set_new_pwd'
                    }
                }]
            }]
        });
    }
});