0

I have been trying to pass an image array as a parameter to a new ExtJS popup-window. I found this in the below link

Extjs pass in parameters to window on show

But when I tried this in my application, it says undefined. Below is my code.

    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;
    }
});

Where Ext.view.ReportExportView extends Ext.window.Window

What I want is a way to pass a javascript array variable to new ExtJS popup window and be able to access that variable in the window.

I found HTML5 localStorage.getItem(). Can I use this to store my array?

Thank you! Stu

1 Answer 1

3

I hope you want the myExtraParams data to be accessed inside ReportExportView window and also from this.reportWindow. If so try this code.

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

Way to access myExtraParams from ReportExportView.

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);  
    }
 });
Sign up to request clarification or add additional context in comments.

4 Comments

But how do I access it in the popup window?
Use initComponent method in ReportExportView definition. With in that, you can just read it like this.myExtraParams. I shall add some code sample if you need.
What I added is var imgsArr = me.myExtraParams.imgArray; in the popup window and it worked! Thank you :)
I'm glad it helped :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.