2012-05-11 115 views
0

喜不工作我是新来的煎茶,我试图在导航我在这里点击在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"); 
       } 

       } 
       ] 

    } 

}); 

回答

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' 
    }); 
}