在ExtJS中的视图之间传递数据

时间:2022-02-14 18:52:39

I am reading data from store and populating main girdView. When any of the row is clicked, a windows appear and I want to fill the fieldset in that window with the same record which is clicked. Can anyone tell me how to do it?

我正在从商店读取数据并填充主要的girdView。单击任何行时,会出现一个窗口,我想在该窗口中填充具有相同记录的字段集。谁能告诉我怎么做?

My popup window is like:

我的弹出窗口如下:

{
    extend: 'Ext.window.Window',

    height: 500,
    width: 1500,
    minWidth :1500,
    maxWidth :1500,
    layout: 'fit',
    controller: 'PopUpWindowController',

    initComponent: function () {

        var me = this;


        //console.log(me.myExtraParams);
        var Store = Ext.getStore('mainStore');

        Ext.applyIf(me, {
         /*   items: [{
                xtype: 'form',
                bodyPadding: 10,
                region: 'center'
            }]*/

        });    
        me.callParent(arguments);
    },      
        items: [
    {      
        xtype: 'panel',
        title : 'Projektierung',
        bodyStyle : 'padding:5px',
        width : 1880,
        autoHeight : true,
        items:
        [ 
            {
                xtype  : 'kopfdatenView', // Have to populate this view
            }
        ]
}]}

and in Main view I am calling it as:

在主视图中,我将其称为:

{ region: 'center', xtype: 'gridpanel',

{region:'center',xtype:'gridpanel',

            listeners : {
                itemdblclick: function(dv, record, item, index, e) {

                    var extra = record.data;
                    win = Ext.create('App.view.PopUpWindow');

                    console.log(win.myExtraParams);

                    win.on('show', function(win) {

                     win.setTitle(record.get('ID'));
                    });

                    win.show();
                }
            },

             columns: [
                      ****
                    ],
            store: 'mainStore', 
            height: 100,
            width: 400,

        }

I want to populate fieldset in kopfdatenView. Kindly help

我想在kopfdatenView中填充fieldset。请帮助

2 个解决方案

#1


You directly pass your record to your window on creation :

您在创建时直接将记录传递到窗口:

win = Ext.create('App.view.PopUpWindow', {
    myRecord: record
});

And then inside the window's initComponent function (before the callParent) :

然后在窗口的initComponent函数内部(在callParent之前):

this.title = this.myRecord.get('ID');

#2


You can do something like this:

你可以这样做:

 win = Ext.create('App.view.PopUpWindow', {
           params: record
       });

Then, in your PopUpWindowController you can retrieve 'params' in the render event (for example).

然后,在PopUpWindowController中,您可以在render事件中检索“params”(例如)。

#1


You directly pass your record to your window on creation :

您在创建时直接将记录传递到窗口:

win = Ext.create('App.view.PopUpWindow', {
    myRecord: record
});

And then inside the window's initComponent function (before the callParent) :

然后在窗口的initComponent函数内部(在callParent之前):

this.title = this.myRecord.get('ID');

#2


You can do something like this:

你可以这样做:

 win = Ext.create('App.view.PopUpWindow', {
           params: record
       });

Then, in your PopUpWindowController you can retrieve 'params' in the render event (for example).

然后,在PopUpWindowController中,您可以在render事件中检索“params”(例如)。