4
votes

I want to pass parameters to my window when I call window.show().

I added in a listener to my window for the show method but it's displaying the parameter as [Object, object].

 #window call
 var test = 'hi';
 tstWin.show(test);

 #listener
  listeners : {             
    'show' : function(test){
        alert(test.value);
     }   
  }
1

1 Answers

8
votes

In your event handler arguments will not be the same as you put into show() method. In fact they have nothing to do with each other.

Read this: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.AbstractComponent-event-show

Show event handler will receive in the first argument reference to the object.

Update:

You can do something like that:

win = Ext.create(...); // Create your window object here
win.myExtraParams = { a: 0, b: 1, c: 2}; // Add additional stuff
win.on('show', function(win) {
   console.log(win.myExtraParams.a, win.myExtraParams.b, win.myExtraParams.c);
});

win.show();