简体   繁体   中英

Extjs - Getting value from Window to Panel and Panel to Window

I have created a panel and placed into the windows. when I click OK button in Window I can get the value of the panel.

            var FormPanel = Ext.create('Ext.form.Panel', {
                id: 'formpanel',
                frame: true,
                renderTo: Ext.getBody(),

                xtype: 'radiogroup',
                fieldLabel: 'Show',
                layout: 'vbox',
                items:

                     {
                    xtype: 'radiogroup',
                    layout: 'hbox',
                    items: [{
                        xtype: 'radiofield',
                        fieldLabel: 'PAN Number*',
                        margin: "20 0 0 0",
                        name: 'rb',
                        inputValue: '1',
                        checked: false,
                        listeners: {
                            change: function(cb, nv, ov) {
                                if (nv) {
                                    Ext.getCmp('AttachData').disable();
                                    Ext.getCmp('PanData').enable();
                                }
                            }
                        }
                    }, {
                        xtype: 'splitter'
                    }, {
                        xtype: 'textfield',
                        emptyText: 'Enter Owner\'s PAN...',
                        margin: "20 0 0 0",
                        id: 'PanData',
                        disabled: false
                    }, ]
                },
            });

            var winPanDetails = Ext.create('Ext.window.Window', {
                height: 250,
                width: 400,
                id:'winPanDetails',
                layout: 'fit',
                modal: true,
                closable: true,
                title: 'Document Attach',
                items: [FormPanel],
                constrain: true,
                renderTo: Ext.getBody(),
                buttons: [{
                    width: 50,
                    text: 'OK',
                    id: 'btnOk',
                    handler: function() {

                        if (Ext.getCmp('PanData').value == "") {
                            Ext.Msg.alert("Tax Benefit Declaration", "Please Pan Number");
                            return;
                        } else {
                            this.up('window').close();

                        }
                    }
                }]
            }).show();

I need to insert this window to my main panel...

Ext.create('Ext.form.Panel', {
    renderTo: 'container',
    title: 'Main Panel',
    defaultType: 'textfield',
    id: 'mainPanel',
    bodyPadding: 10,
    width: 780,
    defaults: {
        labelWidth: 100
    },
    items: [
    {
     //Some more fields
      button:[{
                    width: 50,
                    text: 'OK',
                    id: 'btnOk',
                    handler: function() {
                      //My Window
                 }
            }]
    },

but after inserting I couldn't get the value of the window from my main panel. I tried many logics, Please help me with the logic

 if (Ext.getCmp('PanData').value == "") {
                Ext.Msg.alert("Tax Benefit Declaration", "Please enter  pan number");
                return;
            }

I cant get the value of Ext.getCmp('PanData').value outside the window

Why aren't you using a record to load into the form? And after submitting the form you get the record again from the store? You should not, imo, using the inputs to get the value, but migrate and use the record that's stored in the store..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM