2011-12-16 82 views

回答

1

尝试这样的场景:

SenderView:

initComponent: function() { 

var foo = 'bar'; 
// call to parent initComponent.... 

this.query('#buttonID')[0].on({ 
    scope: this, 
    tap: function (ct) { 
    Ext.dispatch({ 
     controller: 'MyController', 
     action: 'myaction', 
     foo: foo 
    }) 
    } 
}) 
} 

myController的:

myaction : function (options) { 
    var foo = options.foo; 
    this.render ({ 
    xtype: 'myview', 
    foo: foo 
    }) 

} 

MyView的:

initComponent: function() { 
    var config = this.initialConfig, 
    // hopla! foo is transmitted from SenderView to the MyView 
    foo = config.foo; 
    ... 
    console.log(foo) ; // bar 
} 

代码不是真正的考验,但思路是清晰的,我希望 :)

奥列格

相关问题