将值传递给视图

时间:2012-05-13 19:11:37

标签: cordova sencha-touch extjs sencha-touch-2

我正在尝试将一些值传递给View中的另一个Controller。我的代码到目前为止;

success: function (response) {                            
    var text = response.responseText;
    if (result.status == "OK") {
        Ext.getCmp('mainpanel').push({
            title: 'Hello World ',
            html: ['<div>', '<b>HELLO PEOPLE</b>: ', '</div>'].join('')
        });
    }
}

上面的代码在另一个视图中显示html

在我的项目结构中,我有一个名为AnotherView.JS的视图,我需要调用此View,并将值传递给viewAnotherView.JS)。如何修改代码以进行这些更改?

1 个答案:

答案 0 :(得分:0)

假设您有两个视图FirstView和SecondView(xtype:'secondview')并且您在FirstViewController中,您需要添加对第二个视图的引用,如下所示:

config: {
  refs: {
    first: 'firstview',
    second:'secondview'
  }
}

然后,您可以使用this.getSecond()获取第二个视图并随意执行任何操作

希望这有帮助