0

嗨,我是 sencha 的新手,我正在尝试导航,我点击 VehicleSubPage1 中的一个按钮,然后导航到 AccountInfo,但它不起作用,我正在编写代码

谁能帮我

* VehicleSubPage1 类 *

Ext.define("myproject.view.VehicleSubPage1", {
    extend: 'Ext.navigation.View',
        xtype:'VehicleSubPage1form',
        requires: [
        'myproject.view.AccountInfo'
        ],

    config: {

                title: 'Account Info',
                iconCls: 'home',
                styleHtmlContent: true,
                scrollable: true,
                items: [
                {
                    xtype: 'button',
                    text: 'Push another view!',
                    handler: function() {
                      view.push({

                         xtype:'AccountInfoform'

                     });
                    }
                }
            ]        
    }

});

AccountInfo 类

Ext.define("myproject.view.AccountInfo", {
    extend: 'Ext.Panel',
        xtype:'AccountInfoform',
    config: {

               url: 'contact.php',
                title: 'Account Info',
                iconCls: 'home',
                styleHtmlContent: true,
                scrollable: true,
                items:[
                 {
                xtype: 'button',
                text: 'send',
                ui: 'confirm',
                handler:function(){
                alert("clicked");
                }

                } 
                ]   

    }

});
4

1 回答 1

0

似乎问题在于view按钮处理程序中未定义。你真正想做的是调用push导航视图的方法。因此,向您添加一个 id 属性VehicleSubPage1并将处理程序更改为以下内容:

function() {
    var accountInfo = Ext.getCmp('accountInfo'); //assuming you have set the id of VehicleSubPage1 as id: 'accountInfo'
    accountInfo.push({
        xtype:'AccountInfoform'
    });
}
于 2012-06-20T07:44:55.483 回答