传递javascript数组到新的ExtJS弹出窗口

Passing javascript array to new ExtJS popup window

本文关键字:ExtJS 窗口 javascript 数组 传递      更新时间:2023-09-26

我一直在尝试将图像数组作为参数传递给新的ExtJS弹出窗口。我在下面的链接

中找到了这个

Extjs向窗口传递参数

但是当我在我的应用程序中尝试这个时,它显示未定义。下面是我的代码。

    this.btnControlPDF = Ext.create('Ext.button.Button', {          
    width: 40,
    height:33,
    border:0,
    disabled : false,
    style: 'margin: 13px 1px 1px 5px;',
    cls : 'icon-button-ControllListButtonPDF',                        
    enableToggle: true,
    toggleGroup: 'AccumulateToolButtons',
    handler : function(myButton) {
        this.reportWindow = Ext.create('Ext.view.ReportExportView');
        this.reportWindow.myExtraParams = { imgArray : imgArray };
        this.reportWindow.show();
        return;
    }
});

Ext.view.ReportExportView扩展Ext.window.Window

我想要的是一种方法来传递一个javascript数组变量到新的ExtJS弹出窗口,并能够访问该窗口中的变量。

我找到HTML5 localStorage.getItem()。我可以用这个来存储我的数组吗?

谢谢!斯图

我希望您希望在ReportExportView窗口内访问myExtraParams数据,也可以从this.reportWindow访问。如果是的话,试试下面的代码。

 this.reportWindow = Ext.create('Ext.view.ReportExportView', {
                       myExtraParams : { imgArray : imgArray } 
                   } });
 this.reportWindow.show();

ReportExportView访问myExtraParams的方法。

Ext.define('Ext.view.ReportExportView', {
    extend: 'Ext.window.Window',
    alias: 'widget.reportwindoww',
    width: 500,
    height: 250,
    layout: 'fit',
    initComponent: function(){
       console.log(this.myExtraParams);
       //You can write the remaining code here.
       this.items = [{
            xtype: 'panel',
            ...............
            ...............
       }];
       this.callParent(arguments);  
    }
 });