2012-05-11 7 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' 
    }); 
} 
Смежные вопросы