Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extjs pass in parameters to window on show

Tags:

window

extjs

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);
     }   
  }
like image 862
pm13 Avatar asked Feb 21 '23 15:02

pm13


1 Answers

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();
like image 174
sha Avatar answered Feb 27 '23 11:02

sha