导航与推不工作

问题描述:

我有一个问题,导航,我的网页看起来是这样的:导航与推不工作

Ext.define('MyApp.view.MeinView', { 
    extend: 'Ext.navigation.View', 

    config: { 
     items: [ 
      { 
       xtype: 'formpanel', 
       title: 'MyApp', 
       id: 'StartAnsicht', 
       items: [ 
        { 
         xtype: 'list', 
         docked: 'top', 
         height: 200, 
         ui: 'round', 
         itemTpl: [ 
          '<div>{titel}: {inhalt}</div>' 
         ], 
         store: 'EintragStore' 
        }, 
        { 
         xtype: 'button', 
         docked: 'bottom', 
         id: 'NeuerEintrag', 
         itemId: 'mybutton1', 
         ui: 'action', 
         text: 'New' 
        } 
       ] 
      } 
     ], 
     listeners: [ 
      { 
       fn: 'onNeuerEintragTap', 
       event: 'tap', 
       delegate: '#NeuerEintrag' 
      } 
     ] 
    }, 

    onNeuerEintragTap: function(button, e, eOpts) { 
     this.push(Ext.create("MyApp.view.AddAnsicht", { 
      title: "New Item" 
     })); 
    } 

}); 

和:

Ext.define('MyApp.view.AddAnsicht', { 
    extend: 'Ext.form.Panel', 

    config: { 
     id: 'AddAnsicht', 
     items: [ 
      { 
       xtype: 'button', 
       docked: 'bottom', 
       id: 'NeuSubmit', 
       itemId: 'mybutton', 
       ui: 'confirm', 
       text: 'Add' 
      } 
     ], 
     listeners: [ 
      { 
       fn: 'onNeuSubmitTap', 
       event: 'tap', 
       delegate: '#NeuSubmit' 
      } 
     ] 
    }, 

    onNeuSubmitTap: function(button, e, eOpts) { 
     var inhalt = Ext.getStore('EintragStore'); 

     inhalt.add({ inhalt: '1', titel: '2' }); 
     inhalt.sync(); 

     this.push(Ext.create("MyApp.view.MeinView")); 
    } 

}); 

问题:当我到达第二侧和点击我得到的按钮:

Uncaught TypeError: Object [object Object] has no method 'push' 

如何避免这种情况?

的错误是从this.push(Ext.create("MyApp.view.MeinView"));

您在MyApp.view.AddAnsicht做this.push,这是FormPanel中,但是,FormPanel中没有推法。

这就是为什么Uncaught TypeError: Object [object Object] has no method 'push'错误。

您正在试图推到MyApp.view.MeinView (navigation View)MyApp.view.AddAnsicht (form Panel),但是,这是不对的..

你不能推导航视图进入FormPanel中,但你可以把FormPanel中到导航视图。

你真正想做什么?

+0

我可以将两个panals添加到导航视图,然后使用push? – gurehbgui

+0

是的,您可以使用推送 – Viswa

+0

或如何添加s.th来将您想要的面板添加到导航视图中。像this.pop()去看到previeous视图 – gurehbgui