导航与推不起作用

古雷比吉

我的导航出现问题,我的页面如下所示:

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"));

您正在执行this.push,MyApp.view.AddAnsicht它是formPanel,但是formPanel没有push方法。

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

您正在尝试MyApp.view.MeinView (navigation View)加入MyApp.view.AddAnsicht (form Panel),但这是错误的。

您不能将导航视图推入formPanel,但是可以将formpanel推入导航视图。

您真正想做什么?

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章